1 Reply Latest reply on Jun 21, 2011 2:37 AM by saig0

    can not end subprocess in concurrent execution (jBPM4.4)

    saig0

      Hi!

       

      I have a problem with jBPM 4.4 when I try to end a subprocess instance in a concurrent execution.

      This image show an example process:  

      subprocess_in_fork.JPG

      The process should execute a subprocess and wait of a signal in the concurrent execution. When a signal arrive, an external activity behavior (end subprocess) should call that will end the subprocess and both executions will join.

       

      I can run this process correct with jBPM 4.3 but when i try to run with jBPM 4.4 the follow JbpmExecution  throw:

       

      com.ecg.mts.pcc.exceptions.PccException: EXCEPTION_tried to send signal: null to execution with id: SimpleProcess.57.63
      at com.ecg.mts.pcc.internal.jbpm.control.jbpm.JbpmProcessInstanceManager.tryToSendSignalToExecution(JbpmProcessInstanceManager.java:209)
      at com.ecg.mts.pcc.internal.jbpm.control.jbpm.JbpmProcessInstanceManager.sendSignalToActivity(JbpmProcessInstanceManager.java:191)
      at com.ecg.mts.pcc.internal.jbpm.JbpmProcessInstanceManagerTest.testEndSubProcessInstanceInExternalActivity(JbpmProcessInstanceManagerTest.java:174)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at junit.framework.TestCase.runTest(TestCase.java:168)
      at junit.framework.TestCase.runBare(TestCase.java:134)
      at junit.framework.TestResult$1.protect(TestResult.java:110)
      at junit.framework.TestResult.runProtected(TestResult.java:128)
      at junit.framework.TestResult.run(TestResult.java:113)
      at junit.framework.TestCase.run(TestCase.java:124)
      at com.ecg.test.testcase.AbstractDbTestCase.run(AbstractDbTestCase.java:195)
      at junit.framework.TestSuite.runTest(TestSuite.java:232)
      at junit.framework.TestSuite.run(TestSuite.java:227)
      at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
      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)
      Caused by: com.ecg.mts.pcc.exceptions.PccException: EXCEPTION_tried to delete processInstance with id: SimpleSubProcess.64
      at com.ecg.mts.pcc.internal.jbpm.control.jbpm.JbpmProcessInstanceManager.endProcessInstanceById(JbpmProcessInstanceManager.java:91)
      at com.ecg.mts.pcc.internal.jbpm.control.jbpm.JbpmProcessInstanceManager$1.execute(JbpmProcessInstanceManager.java:107)
      at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
      at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:40)
      at org.jbpm.pvm.internal.processengine.ProcessEngineImpl.execute(ProcessEngineImpl.java:300)
      at com.ecg.mts.pcc.internal.jbpm.control.jbpm.JbpmEngine.executeCommand(JbpmEngine.java:194)
      at com.ecg.mts.pcc.internal.jbpm.control.jbpm.JbpmProcessInstanceManager.endProcessInstanceByIdCascade(JbpmProcessInstanceManager.java:112)
      at com.ecg.mts.pcc.internal.jbpm.control.jbpm.JbpmProcessInstanceManager$1.execute(JbpmProcessInstanceManager.java:106)
      at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
      at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:40)
      at org.jbpm.pvm.internal.processengine.ProcessEngineImpl.execute(ProcessEngineImpl.java:300)
      at com.ecg.mts.pcc.internal.jbpm.control.jbpm.JbpmEngine.executeCommand(JbpmEngine.java:194)
      at com.ecg.mts.pcc.internal.jbpm.control.jbpm.JbpmProcessInstanceManager.endProcessInstanceByIdCascade(JbpmProcessInstanceManager.java:112)
      at com.ecg.mts.pcc.internal.jbpm.scenario.externalActivityBehaviour.EndSubProcess.execute(EndSubProcess.java:18)
      at org.jbpm.pvm.internal.wire.usercode.UserCodeActivityBehaviour.execute(UserCodeActivityBehaviour.java:42)
      at org.jbpm.pvm.internal.model.op.ExecuteActivity.perform(ExecuteActivity.java:60)
      at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:672)
      at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:632)
      at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:430)
      at org.jbpm.pvm.internal.cmd.SignalCmd.execute(SignalCmd.java:61)
      at org.jbpm.pvm.internal.cmd.SignalCmd.execute(SignalCmd.java:35)
      at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
      at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:50)
      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:56)
      at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)
      at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.signalExecutionById(ExecutionServiceImpl.java:89)
      at com.ecg.mts.pcc.internal.jbpm.control.jbpm.JbpmProcessInstanceManager.tryToSendSignalToExecution(JbpmProcessInstanceManager.java:205)
      ... 22 more
      Caused by: org.jbpm.api.JbpmException: execution[SimpleProcess.57.62] has running subprocess: execution[SimpleSubProcess.64] in state remove
      at org.jbpm.pvm.internal.model.ExecutionImpl.checkActive(ExecutionImpl.java:1086)
      at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:424)
      at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:412)
      at org.jbpm.pvm.internal.model.ExecutionImpl.end(ExecutionImpl.java:393)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
      at org.jbpm.pvm.internal.model.ExecutionImpl_$$_javassist_189.end(ExecutionImpl_$$_javassist_189.java)
      at org.jbpm.pvm.internal.cmd.EndProcessInstance.execute(EndProcessInstance.java:48)
      at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
      at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:40)
      at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.endProcessInstance(ExecutionServiceImpl.java:117)
      at com.ecg.mts.pcc.internal.jbpm.control.jbpm.JbpmProcessInstanceManager.endProcessInstanceById(JbpmProcessInstanceManager.java:87)
      ... 50 more

       

      org.jbpm.api.JbpmException: execution[SimpleProcess.57.62] has running subprocess: execution[SimpleSubProcess.64] in state remove
           at org.jbpm.pvm.internal.model.ExecutionImpl.checkActive(ExecutionImpl.java:1086)
           at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:424)
           at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:412)
           at org.jbpm.pvm.internal.model.ExecutionImpl.end(ExecutionImpl.java:393)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)
           at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
           at org.jbpm.pvm.internal.model.ExecutionImpl_$$_javassist_189.end(ExecutionImpl_$$_javassist_189.java)
           at org.jbpm.pvm.internal.cmd.EndProcessInstance.execute(EndProcessInstance.java:48)
           at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
           at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:40)
           at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.endProcessInstance(ExecutionServiceImpl.java:117)
           ...
      

       

       

      I tried to end the subprocess instance like this:

      executionService.endProcessInstance(processInstanceId, "remove"); 

      (processInstanceId is the id of the execution in activity 'subprocess')

       

      I also tried to send a signal to this execution but it throw the same exception.

       

      It seems that I have to end the subprocess instance first, so I tried something like that but it doesn't work and throw the exception.

      public void endProcessInstanceByIdCascade(final String processInstanceId)    {
              Command<Object> command = new Command<Object>()        {
      
                  public Object execute(Environment environment) throws Exception            {
                      ProcessInstance processInstance = executionService.findProcessInstanceById(processInstanceId);
                      Execution subProcessInstance = processInstance.getSubProcessInstance();
                      if (subProcessInstance != null) endProcessInstanceByIdCascade(subProcessInstance.getId());
                      executionService.endProcessInstance(processInstanceId, "remove");
                      return null;           
                 }
              };
              processEngine.execute(command);
          }
      

       

      Did I make something wrong or is this a bug in jBPM 4.4?

       

      Thank you for help!

      Phil