5 Replies Latest reply on Jul 6, 2010 4:40 AM by Stephen Sitton

    JBPM Exception when running workflow

    Stephen Sitton Newbie

      Hi Guys,

       

      I'm pretty new to jBPM and am seeing a couple of issues that hopefully someone can help with.
      I have a workflow that basically parses a set of XML files and moves these to different directories depending on the stage of the processing and the overall outcome.  If there is only one file to process this workflow is fine but once I add another file I start seeing exceptions from JBPM.
      JBPM: 4.0 (but have also tried 4.2 with the same errors)
      Spring 3
      JBoss 5.0.1GA
      My workflow is setup as:
      <?xml version="1.0" encoding="UTF-8"?>
      <process id="settlementProcessor" name="settlementProcessor" xmlns="http://jbpm.org/4.0/jpdl">
          <start name="start1" g="236,45,48,48">
              <transition name="to localGetSettlementFileChecker" to="localGetSettlementFileChecker" g="-135,-22"/>
          </start>
          <decision name="localGetSettlementFileChecker">
              <handler>
                   <field name="fromVariable"><string value="farDirectoryFiles"/></field>
              </handler>
              <transition name="yes" to="moveFileDownloadAct" />
              <transition name="no" to="t_end" />
          </decision>
          <custom name="moveFileDownloadAct" g="185,140,133,52"   class="com.workFlowProcessor.actions.MoveFileActivity">
            <field name="fromVariable"><string value="farDirectoryFiles"/></field>
            <field name="toVariable"><string value="farDirectoryProcessing"/></field>
              <transition name="to processSettlementAct" to="processSettlementAct" g="-54,-22"/>
          </custom>
          <custom name="processSettlementAct" g="192,217,147,52" class="com.workFlowProcessor.actions.SettlementProcessorActivity">
             <field name="directory"><string value="farDirectoryProcessing"/></field>
             <transition name="to processFarActivities" to="processFarActivities" g="-133,-11"/>
          </custom>
          <group name="processFarActivities">
              <start>
                  <transition to="convertDataToMsgAct" />
              </start>
              <custom name="convertDataToMsgAct"   class="com.workFlowProcessor.actions.SettlementDataConverterActivity">
                  <transition to="groupDoneAct" />
              </custom>
              <end name="groupDoneAct" />
              <transition to="t_join" />
          </group>
          <custom name="t_join">
              <transition to="farProcessChecker" />
          </custom>
          <decision name="farProcessChecker">
              <handler class="com.workFlowProcessor.actions.SettlementFileChecker"  />
              <transition name="good" to="moveSuccessfulFileAct" />
              <transition name="bad" to="moveFailedFileAct" />
          </decision>
          <custom name="moveSuccessfulFileAct" g="185,140,133,52"    class="com.workFlowProcessor.actions.MoveFileActivity">
              <field name="fromVariable"><string value="farDirectoryProcessing"/></field>
              <field name="toVariable"><string value="farDirectorySuccess"/></field>
              <field name="addTimestamp"><true /></field>
              <transition name="to localGetSettlementFileChecker" to="localGetSettlementFileChecker" g="-54,-22"/>
          </custom>
          <custom name="moveFailedFileAct" g="185,140,133,52"    class="com.afp.workFlowProcessor.actions.MoveFileActivity">
              <field name="fromVariable"><string value="farDirectoryProcessing"/></field>
              <field name="toVariable"><string value="farDirectoryFailure"/></field>
              <field name="addTimestamp"><true /></field>
              <transition name="to localGetSettlementFileChecker" to="localGetSettlementFileChecker" g="-54,-22"/>
          </custom>
          <end name="t_end" g="234,468,48,48"/>
      </process>
      This is the exception I'm getting:
      10:18:25,155 INFO  [DefaultCommandService] exception while executing command org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd@1e31239
      java.lang.NullPointerException
      at org.jbpm.pvm.internal.model.op.ExecuteEventListener.perform(ExecuteEventListener.java:68)
      at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:655)
      at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:615)
      at org.jbpm.pvm.internal.model.ExecutionImpl.start(ExecutionImpl.java:215)
      at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:65)
      at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:38)
      at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
      at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
      at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
      at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceByKey(ExecutionServiceImpl.java:70)
      at com.playphone.alexander.afp.workFlowProcessor.WorkFlowProcess.run(WorkFlowProcess.java:62)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:619)
      10:18:25,157 ERROR [STDERR] java.lang.NullPointerException
      10:18:25,157 ERROR [STDERR]      at org.jbpm.pvm.internal.model.op.ExecuteEventListener.perform(ExecuteEventListener.java:68)
      10:18:25,157 ERROR [STDERR]      at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:655)
      10:18:25,157 ERROR [STDERR]      at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:615)
      10:18:25,157 ERROR [STDERR]      at org.jbpm.pvm.internal.model.ExecutionImpl.start(ExecutionImpl.java:215)
      10:18:25,157 ERROR [STDERR]      at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:65)
      10:18:25,157 ERROR [STDERR]      at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:38)
      10:18:25,157 ERROR [STDERR]      at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
      10:18:25,158 ERROR [STDERR]      at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
      10:18:25,158 ERROR [STDERR]      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
      10:18:25,158 ERROR [STDERR]      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
      10:18:25,158 ERROR [STDERR]      at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
      10:18:25,158 ERROR [STDERR]      at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceByKey(ExecutionServiceImpl.java:70)
      10:18:25,158 ERROR [STDERR]      at com.playphone.alexander.afp.workFlowProcessor.WorkFlowProcess.run(WorkFlowProcess.java:62)
      10:18:25,158 ERROR [STDERR]      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      10:18:25,158 ERROR [STDERR]      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      10:18:25,158 ERROR [STDERR]      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      10:18:25,158 ERROR [STDERR]      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      10:18:25,158 ERROR [STDERR]      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      10:18:25,158 ERROR [STDERR]      at java.lang.Thread.run(Thread.java:619)
      
      I am also seeing this exception on certain runs too:
       10:36:21,846 INFO  [DefaultCommandService] exception while executing command   org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd@11c8223
       org.jbpm.api.JbpmException: processInstanceId is null
      at org.jbpm.pvm.internal.hibernate.DbSessionImpl.deleteProcessInstance(DbSessionImpl.java:231)
      at org.jbpm.pvm.internal.model.ExecutionImpl.end(ExecutionImpl.java:381)
      at org.jbpm.jpdl.internal.activity.EndActivity.execute(EndActivity.java:82)
      at org.jbpm.jpdl.internal.activity.EndActivity.execute(EndActivity.java:45)
      at org.jbpm.pvm.internal.model.op.ExecuteActivity.perform(ExecuteActivity.java:60)
      at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:655)
      at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:615)
      at org.jbpm.pvm.internal.model.ExecutionImpl.start(ExecutionImpl.java:215)
      at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:65)
      at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:38)
      at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
      at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
      at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
      at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceByKey(ExecutionServiceImpl.java:70)
      at com.playphone.alexander.afp.workFlowProcessor.WorkFlowProcess.run(WorkFlowProcess.java:62)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:619)
       10:36:21,848 ERROR [STDERR] org.jbpm.api.JbpmException: processInstanceId is null
       10:36:21,849 ERROR [STDERR]      at org.jbpm.pvm.internal.hibernate.DbSessionImpl.deleteProcessInstance(DbSessionImpl.java:231)
       10:36:21,849 ERROR [STDERR]      at org.jbpm.pvm.internal.model.ExecutionImpl.end(ExecutionImpl.java:381)
       10:36:21,849 ERROR [STDERR]      at org.jbpm.jpdl.internal.activity.EndActivity.execute(EndActivity.java:82)
       10:36:21,849 ERROR [STDERR]      at org.jbpm.jpdl.internal.activity.EndActivity.execute(EndActivity.java:45)
       10:36:21,849 ERROR [STDERR]      at org.jbpm.pvm.internal.model.op.ExecuteActivity.perform(ExecuteActivity.java:60)
       10:36:21,849 ERROR [STDERR]      at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:655)
       10:36:21,849 ERROR [STDERR]      at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:615)
       10:36:21,849 ERROR [STDERR]      at org.jbpm.pvm.internal.model.ExecutionImpl.start(ExecutionImpl.java:215)
       10:36:21,850 ERROR [STDERR]      at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:65)
      10:36:21,850 ERROR [STDERR]      at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:38)
      10:36:21,850 ERROR [STDERR]      at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
      10:36:21,850 ERROR [STDERR]      at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
      10:36:21,850 ERROR [STDERR]      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
      10:36:21,850 ERROR [STDERR]      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
      10:36:21,850 ERROR [STDERR]      at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
      10:36:21,850 ERROR [STDERR]      at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceByKey(ExecutionServiceImpl.java:70)
      10:36:21,850 ERROR [STDERR]      at com.playphone.alexander.afp.workFlowProcessor.WorkFlowProcess.run(WorkFlowProcess.java:62)
      10:36:21,851 ERROR [STDERR]      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      10:36:21,851 ERROR [STDERR]      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      10:36:21,851 ERROR [STDERR]      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      10:36:21,851 ERROR [STDERR]      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      10:36:21,851 ERROR [STDERR]      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      10:36:21,851 ERROR [STDERR]      at java.lang.Thread.run(Thread.java:619)
      
      Does anyone know what the problem could be?  I could try this out on 4.3/4.4 but would like to understand what the problem is before I do.
      Any help is much appreciated.
      Steve
        • 1. Re: JBPM Exception when running workflow
          Stephen Sitton Newbie

          Bump.

           

          Has anyone seen this exception before?  I don't have any event listeners defined in my process file (shown in previous post).  Wondering if anyone knows a workaround for this?

           

           

          10:18:25,155 INFO  [DefaultCommandService] exception while executing command org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd@1e31239
          java.lang.NullPointerException
          at org.jbpm.pvm.internal.model.op.ExecuteEventListener.perform(ExecuteEventListener.java:68)
          at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:655)
          at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:615)
          at org.jbpm.pvm.internal.model.ExecutionImpl.start(ExecutionImpl.java:215)
          at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:65)
          at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:38)
          at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
          at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
          at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
          at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
          at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
          
          

          thanks

          Steve

          • 2. Re: JBPM Exception when running workflow
            Maciej Swiderski Master

            Could you post your process definition together with jbpm test case? Then I could look into it.

            • 3. Re: JBPM Exception when running workflow
              Stephen Sitton Newbie

              Hi Maciej,

               

              Thanks for the response.  Attached is the test (+additional files) which displays the error (org.jbpm.test.CustomTest).  The process definition (process.jpdl.xml) is also in the zip.  This is using jBPM 4.0.

               

              The output from the test is:

               

              Processing 2 files in directory "testfiles"
              Processing file "file2.zip"
              Extracting the file :file2.xml
              Extracted the file :file2.xml
              Data Convert message - 384
              Data Convert message - 385
              Data Convert message - 386
              Data Convert message - 387
              Data Convert message - 388
              Data Convert message - 389
              Data Convert message - 381
              Data Convert message - 382
              Extracting the file :file1.xml
              Extracted the file :file1.xml
              Data Convert message - 112
              Data Convert message - 113
              Data Convert message - 114
              Data Convert message - 111
              Data Convert message - 115
              Data Convert message - 116
              Data Convert message - 117
              Data Convert message - 118
              Data Convert message - 119

               

              The exception I get is...

               

              java.lang.NullPointerException
                   at org.jbpm.pvm.internal.model.op.ExecuteEventListener.perform(ExecuteEventListener.java:68)
                   at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:637)
                   at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:597)
                   at org.jbpm.pvm.internal.model.ExecutionImpl.start(ExecutionImpl.java:201)
                   at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:64)
                   at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:37)
                   at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
                   at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
                   at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:54)
                   at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
                   at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceByKey(ExecutionServiceImpl.java:66)
                   at org.jbpm.test.CustomTest.testProcess(CustomTest.java:24)
                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:597)
                   at junit.framework.TestCase.runTest(TestCase.java:154)
                   at org.jbpm.test.BaseJbpmTestCase.runTest(BaseJbpmTestCase.java:80)
                   at junit.framework.TestCase.runBare(TestCase.java:127)
                   at junit.framework.TestResult$1.protect(TestResult.java:106)
                   at junit.framework.TestResult.runProtected(TestResult.java:124)
                   at junit.framework.TestResult.run(TestResult.java:109)
                   at junit.framework.TestCase.run(TestCase.java:118)
                   at junit.framework.TestSuite.runTest(TestSuite.java:208)
                   at junit.framework.TestSuite.run(TestSuite.java:203)
                   at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
                   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
                   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
                   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
                   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
                   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
              
              

               

              Please let me know if there I something I'm doing wrong or if there is a problem in jbpm.

               

              thanks

              Steve

              • 4. Re: JBPM Exception when running workflow
                Maciej Swiderski Master

                Hi Steve,

                 

                good news, I think I got it. First of all (happily) this is not jBPM issue

                 

                You just forgot to clean up process variables after first execution that's why it worked with only one file. I modified a bit FileChecked decision handler to remove one variable prior to returning the result (line in bold):

                 

                      } else {
                            result = "no";
                            cleanUp(oe);
                        }
                        oe.removeVariable(ActivityShareInfo.JoinCompleteIndicator.name);
                        return result;
                

                After that it works like a charm.

                 

                Seems like you developed your custom foreach functionality?! If so you should look into foreach activity that is part of 4.4 version. Just search this forum for details or grab trunk version from svn to get an overview... you can always post questions here as well.

                 

                HTH

                Maciej

                • 5. Re: JBPM Exception when running workflow
                  Stephen Sitton Newbie

                  Great, thanks for your help Maciej.  I'll take a look into the foreach activity.