I am trying to add userId and adding groups to process engine after fetching from header in REST API.
Code for creating user and group membership
private void setGroupMembership(String userId, IdentityService identityService) throws Exception{ // throws AuthenticationException
/* When uncommented: Exception: User already exist
User user = identityService.newUser(userId);
identityService.saveUser(user);
*/
if (groupIds.isEmpty()) {
throw new Exception("Group Id is null");
}
for (String groupId: groupIds) {
/* When uncommented: Exception: Group already exist
Group group = identityService.newGroup(groupId);
identityService.saveGroup(group);
*/
// create membership
identityService.createMembership(userId, groupId);
}
}
I am getting the following error when I try to open Camunda Webapp
org.camunda.bpm.engine.ProcessEngineException: ENGINE-03083 Unexpected exception while executing database
### Error updating database. Cause: java.lang.NullPointerException
### The error may involve org.camunda.bpm.engine.impl.persistence.entity.MembershipRelation.insertMembership-Inline
### The error occurred while setting parameters
### SQL: insert into ACT_ID_MEMBERSHIP (USER_ID_, GROUP_ID_) values ( ?, ? )
### Cause: java.lang.NullPointerException