Hi there, I’m having some trouble when calling the rxjava UserManagementClient like this:
ledgerClient.getUserManagementClient.createUser(
new CreateUserRequest(
new User(myUser),
new User.Right.CanActAs(myParty1),
new User.Right.CanActAs(myParty2)
)
).blockingGet();
It’s giving me a NullPointerException. There is no issue when using the other CreateUserRequest constructor – see below:
java.lang.NullPointerException: null
at com.daml.ledger.api.v1.admin.UserManagementServiceOuterClass$User$Builder.setPrimaryParty(UserManagementServiceOuterClass.java:1028)
at com.daml.ledger.javaapi.data.User.toProto(User.java:29)
at com.daml.ledger.javaapi.data.CreateUserRequest.toProto(CreateUserRequest.java:40)
at com.daml.ledger.rxjava.grpc.UserManagementClientImpl.createUser(UserManagementClientImpl.java:30)
at com.daml.ledger.rxjava.grpc.UserManagementClientImpl.createUser(UserManagementClientImpl.java:36)
...
It looks like there is probably a bug when trying to create a user without a primary party. Are you deliberately not setting one? Could you try new User(myUser, myParty1)?
My workaround is to set the primary party as shown below. Must be some bug related to not having a primary party.
ledgerClient.getUserManagementClient.createUser(
new CreateUserRequest(
new User(myUser, myParty1),
new User.Right.CanActAs(myParty1),
new User.Right.CanActAs(myParty2)
)
).blockingGet();