Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-10797

NullPointerException when creating a group membership for non-existing user

XMLWordPrintable

      Component

      https://github.com/camunda/camunda-bpm-platform/tree/master/engine

      Steps to reproduce

      • Create a group membership via identity service (IdentityService#createMembership for a user that does not exist.

      Observed Behavior

      • NullPointerException with the following stacktrace:
        09:54:07.143 [main] ERROR org.camunda.bpm.engine.context - ENGINE-16004 Exception while closing command context: ENGINE-03083 Unexpected exception while executing database operations with message '
        ### 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'. Flush summary: 
         [
          INSERT MembershipEntity[7]
        ]
        org.camunda.bpm.engine.ProcessEngineException: ENGINE-03083 Unexpected exception while executing database operations with message '
        ### 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'. Flush summary: 
         [
          INSERT MembershipEntity[7]
        ]
        	at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.flushDbOperationsException(EnginePersistenceLogger.java:693) ~[classes/:na]
        	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:341) ~[classes/:na]
        	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(DbEntityManager.java:322) ~[classes/:na]
        	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:294) ~[classes/:na]
        	at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:263) ~[classes/:na]
        	at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:186) ~[classes/:na]
        	at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:119) [classes/:na]
        	at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70) [classes/:na]
        	at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33) [classes/:na]
        	at org.camunda.bpm.engine.impl.IdentityServiceImpl.createMembership(IdentityServiceImpl.java:158) [classes/:na]
        	at org.camunda.bpm.engine.test.api.task.TaskQueryOrTest.shouldReturnTasksWithTaskCandidateUserOrTaskCandidateGroup(TaskQueryOrTest.java:231) [test-classes/:na]
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_172]
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_172]
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_172]
        	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_172]
        	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) [junit-4.12.jar:4.12]
        	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]
        	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) [junit-4.12.jar:4.12]
        	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) [junit-4.12.jar:4.12]
        	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) [junit-4.12.jar:4.12]
        	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) [junit-4.12.jar:4.12]
        	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55) [junit-4.12.jar:4.12]
        	at org.camunda.bpm.engine.test.ProcessEngineRule$1.evaluate(ProcessEngineRule.java:172) [classes/:na]
        	at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:239) [junit-4.12.jar:4.12]
        	at org.junit.rules.RunRules.evaluate(RunRules.java:20) [junit-4.12.jar:4.12]
        	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) [junit-4.12.jar:4.12]
        	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) [junit-4.12.jar:4.12]
        	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) [junit-4.12.jar:4.12]
        	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
        	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
        	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
        	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
        	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
        	at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
        	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) [.cp/:na]
        	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na]
        	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538) [.cp/:na]
        	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760) [.cp/:na]
        	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460) [.cp/:na]
        	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206) [.cp/:na]
        Caused by: org.apache.ibatis.exceptions.PersistenceException: 
        ### 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
        	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) ~[mybatis-3.4.4.jar:3.4.4]
        	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:200) ~[mybatis-3.4.4.jar:3.4.4]
        	at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185) ~[mybatis-3.4.4.jar:3.4.4]
        	at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.executeInsertEntity(DbSqlSession.java:257) ~[classes/:na]
        	at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.insertEntity(DbSqlSession.java:252) ~[classes/:na]
        	at org.camunda.bpm.engine.impl.db.AbstractPersistenceSession.executeDbOperation(AbstractPersistenceSession.java:44) ~[classes/:na]
        	at org.camunda.bpm.engine.impl.db.sql.BatchDbSqlSession.executeDbOperations(BatchDbSqlSession.java:61) ~[classes/:na]
        	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:339) ~[classes/:na]
        	... 38 common frames omitted
        Caused by: java.lang.NullPointerException: null
        	at org.camunda.bpm.engine.impl.persistence.entity.MembershipEntity.getUserId(MembershipEntity.java:68) ~[classes/:na]
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_172]
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_172]
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_172]
        	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_172]
        	at org.apache.ibatis.reflection.invoker.MethodInvoker.invoke(MethodInvoker.java:41) ~[mybatis-3.4.4.jar:3.4.4]
        	at org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:164) ~[mybatis-3.4.4.jar:3.4.4]
        	at org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:49) ~[mybatis-3.4.4.jar:3.4.4]
        	at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:122) ~[mybatis-3.4.4.jar:3.4.4]
        	at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:79) ~[mybatis-3.4.4.jar:3.4.4]
        	at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:93) ~[mybatis-3.4.4.jar:3.4.4]
        	at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:64) ~[mybatis-3.4.4.jar:3.4.4]
        	at org.apache.ibatis.executor.BatchExecutor.doUpdate(BatchExecutor.java:71) ~[mybatis-3.4.4.jar:3.4.4]
        	at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) ~[mybatis-3.4.4.jar:3.4.4]
        	at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) ~[mybatis-3.4.4.jar:3.4.4]
        	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198) ~[mybatis-3.4.4.jar:3.4.4]
        	... 44 common frames omitted
        

      Expected behavior

      • A proper ProcessEngineException is thrown that explains in the message that the user does not exist

      Implementation notes

      • Check if the same is true for groups that do not exist. And fix it in that case as well.

        This is the controller panel for Smart Panels app

              miklas.boskamp Miklas Boskamp
              thorben.lindhauer Thorben Lindhauer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: