5 Replies Latest reply on Aug 20, 2014 7:09 AM by silver lee

    jbpm 5.4.0 - NullPointerException completing workItem when using Spring local transactions and shared entity manager.

    J Xmith Newbie

      I decided to give it a try to Spring local transactions and shared entity manager, so I changed my configuration as per user guide v5.4.

      I tested with a fairly simple business process with an asynchronous workItem that get completed after certain amount of time by a different thread.

      Everything went well until the scheduled timer tried to complete the workItem by calling:

       

           ksession.getWorkItemManager().completeWorkItem(workItemId, resultMap);

       

      By executing this line, I am getting this exception:

       

      2013-01-10 15:13:46,234 ERROR  [Timer-0] SingleSessionCommandService M[rollbackTransaction] --> Could not commit session

      java.lang.NullPointerException

          at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:306)

          at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:285)

          at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:342)

          at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:121)

          at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:69)

          at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:32)

          at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)

          at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:373)

          at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150)

       

      The passed workItemId is correct (the expected one).

      The same test runs successfully when configuring for JTA transaction management. Should I create a Jira issue for this?

       

      Regards,

      John

        • 1. Re: jbpm 5.4.0 - NullPointerException completing workItem when using Spring local transactions and shared entity manager.
          Maciej Swiderski Master

          could you provide your spring configuration? Or even better a test case

           

          it looks like the work item cannot be found in the data base...

           

          Cheers

          • 2. Re: jbpm 5.4.0 - NullPointerException completing workItem when using Spring local transactions and shared entity manager.
            J Xmith Newbie

            Thanks Maciej,

             

            I think you will agree that if the workItem cannot be found in DB one would expect a different error rather than a misleading NullPointerException.

            I believe this itself should be considered a bug. What's your view on this?

             

            Regards,

            J

            • 3. Re: jbpm 5.4.0 - NullPointerException completing workItem when using Spring local transactions and shared entity manager.
              Maciej Swiderski Master

              if it is not a result of misconfiguration I would completely agree. Anyway, if you have a reproducible test for it please file a jira issue so we could work on it.

               

              Cheers

              • 4. Re: jbpm 5.4.0 - NullPointerException completing workItem when using Spring local transactions and shared entity manager.
                Dakshesh Patel Newbie

                Hi Maciej

                I am getting same issue mentioned above when using jbpm 5.4 with JPA-2 using jpa transaction management while completing work item.

                 

                Logger :

                select workitemin0_.workItemId as workItemId2_0_, workitemin0_.creationDate as creation2_2_0_, workitemin0_.name as name2_0_, workitemin0_.processInstanceId as processI4_2_0_, workitemin0_.state as state2_0_, workitemin0_.OPTLOCK as OPTLOCK2_0_, workitemin0_.workItemByteArray as workItem7_2_0_ from WorkItemInfo workitemin0_ where workitemin0_.workItemId=?

                binding parameter [1] as [BIGINT] - 154

                Found [2013-11-27 19:16:22.867] as column [creation2_2_0_]

                Found [Human Task] as column [name2_0_]

                Found [7] as column [processI4_2_0_]

                Found [0] as column [state2_0_]

                Found [1] as column [OPTLOCK2_0_]

                Found [[B@1f937c1] as column [workItem7_2_0_]

                SingleSessionCommandService -Could not commit session

                java.lang.NullPointerException

                    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:306)[jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:285)[jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                    at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:342)[jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                    at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:121)[drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

                    at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:69)[drools-core-5.5.0.Final.jar:5.5.0.Final]

                    at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:32)[drools-core-5.5.0.Final.jar:5.5.0.Final]

                    at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)[drools-core-5.5.0.Final.jar:5.5.0.Final]

                    at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:373)[drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

                    at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150)[drools-core-5.5.0.Final.jar:5.5.0.Final]

                    at com.tcs.city.service.impl.JBPMServiceImpl.finishJBPMEvent(JBPMServiceImpl.java:513)[JBPMServiceImpl.class:]

                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_25]

                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_25]

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_25]

                    at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_25]

                 

                 

                You can see workitem id is there in the database.

                Kindly provide your inputs on this.

                Should i move to JTA instead of JPA to resolve this issue as mentioned by j Xmith?

                • 5. Re: jbpm 5.4.0 - NullPointerException completing workItem when using Spring local transactions and shared entity manager.
                  silver lee Newbie

                  I use Spring local transactions and shared entity manager. I have the same problem. When single user operates everythings ok, but multiple user operates occasionally throws exception like below:

                   

                  java.lang.NullPointerException

                    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:306)

                    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:285)

                    at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:342)

                    at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:121)

                    at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:69)

                    at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:32)

                    at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)

                    at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:373)

                    at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150)

                   

                   

                   

                   

                  java.lang.NullPointerException

                    at org.jbpm.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:68)

                    at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.getWorkflowProcess(WorkflowProcessInstanceImpl.java:181)

                    at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.getNodeContainer(WorkflowProcessInstanceImpl.java:69)

                    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.getNode(NodeInstanceImpl.java:103)

                    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.getNodeName(NodeInstanceImpl.java:79)

                    at org.jbpm.workflow.instance.WorkflowRuntimeException.<init>(WorkflowRuntimeException.java:33)

                    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:132)

                    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279)

                    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238)

                    at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47)

                    at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:216)

                    at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:196)

                    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.triggerCompleted(WorkItemNodeInstance.java:247)

                    at org.jbpm.workflow.instance.node.HumanTaskNodeInstance.triggerCompleted(HumanTaskNodeInstance.java:90)

                    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:309)

                    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:285)

                    at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:342)