2 Replies Latest reply on Dec 14, 2011 3:08 AM by mpiraccini

    Weird problem with new JBPM 5.2 release

    mpiraccini

      Hi,

      I have a very strange issue with the new JBPM 5.2 (with JPA persistence activated). In processes that end in the same call used to start the process  (for instance a process with only script task). In these case, indeed, I have this NPE:

       

      java.lang.NullPointerException

          at org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:172)

          at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:138)

          at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1079)

          at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:306)

          at org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:119)

          at org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:38)

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

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

          at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:223)

       

      Debugging the JBPM code, it seems that in org.jbpm.process.instance.ProcessRuntimeImpl, when the process is started (and -subsequentially- ended), the Session reference goes to null (and then the NPE is thrown).

      The very same process definitions work well with JBPM 5.1

      It's a regression?

        • 1. Re: Weird problem with new JBPM 5.2 release
          swiderski.maciej

          Do you create new session or load it from the data base?

          I had similar issue (can't say it was exactly the same) that was caused by incompatible session snapshots in db, unfortunately could not find out what was the root of the incompatibility but after creating session instead of loading resolved the problem.

           

          HTH

          • 2. Re: Weird problem with new JBPM 5.2 release
            mpiraccini

            I answer  to my own question. In my code, to avoid to dipose the session "manually", I manage the afterProcessCompleted event:

             

            public void afterProcessCompleted(ProcessCompletedEvent event)

                {

                    // Dispose the session.

                    // Commented with JBPM 5.2

                    ((StatefulKnowledgeSession) event.getKnowledgeRuntime()).dispose();

                }

             

            That turns to null the session.

            With JBPM 5.2, after the process is completed, the InternalKnowledgeRuntime.endOperation is executed, soi a NPE is thrown.