1 Reply Latest reply on Oct 10, 2011 11:28 AM by Al Daher

    JBPM 3.1 Exception thrown on EndState

    Al Daher Newbie

      Hi,

       

      i am running my first JBPM example and i am encountrin a thrown exception at the end of the process.

      The flow from start State through the next Nodes is gone smoothly except when the token is at end State i get the following exception message

      org.jbpm.JbpmException: can't leave node 'EndState(endProjectManagementProcess)' without leaving transition.

       

      What i understand is that it's expecting a transition  a transition on End State Node. But what i know is that end state has no further transitions.

      Exception is thrown in Node class because transition is null.

      For my end state i did not configure anything (neither an exception nor an event)

       

      My Process definition

       

      <?xml version="1.0" encoding="UTF-8"?>

       

      <process-definition

        xmlns="urn:jbpm.org:jpdl-3.1"

        name="projectManagementProcess">

         <start-state name="startProjectManagementProcess">

           <task>

              <controller>

                <variable name="color" />

                <variable name="size" />

              </controller>

            </task>

              <transition to="validateProject" name="toValidateProject"></transition>

         </start-state>

         <node name="validateProject">

              <action class="com.cmp.fo3test.workflow.action.ValidateProjectHandler"></action>

              <transition to="decideWhetherValidOrNot" name="toDecideUponValidationResult"></transition>

          </node>

       

          <node name="createProject">

              <action class="com.cmp.fo3test.workflow.action.CreateProjectHandler"></action>

              <transition to="waitForProjectAssignmentTrigger"></transition>

          </node>

       

          <task-node name="waitForProjectAssignmentTrigger">

              <transition to="decideUponProjectStatusChange" name="toDecideUponProjectStatusChange"></transition>

          </task-node>

       

          <decision name="decideUponProjectStatusChange">

              <handler class="com.cmp.fo3test.workflow.action.ProjectStatusChangeDecisionHandler"></handler>

              <transition to="endProjectManagementProcess" name="toEndProjectWithNoTeamAssignment"></transition>

              <transition to="waitForProjectStatusChangeTrigger" name="toWaitForTeamOrCustomerTrigger"></transition>

          </decision>

       

          <task-node name="waitForProjectStatusChangeTrigger">

              <transition to="decideUponTeamandCustomerActions"></transition>

          </task-node>

       

          <decision name="decideUponTeamandCustomerActions">

              <handler class="com.cmp.fo3test.workflow.action.ProjectStatusChangeDecisionHandler"></handler>

              <transition to="endProjectManagementProcess" name="toEndProcessWithProjectAccomplished"></transition>

              <transition to="reopenProjectForMainteneance" name="toReopenProjectForMainteneance"></transition>

          </decision>

       

          <node name="reopenProjectForMainteneance">

              <transition to="waitForProjectStatusChangeTrigger"></transition>

          </node>

       

          <decision name="decideWhetherValidOrNot">

              <handler class="com.cmp.fo3test.workflow.action.ProjectStatusChangeDecisionHandler"></handler>

              <transition to="deleteProject" name="toEndProjectManagementProcessIfNotValid"></transition>

              <transition to="createProject" name="toCreateProject"></transition>

          </decision>

       

          <node name="deleteProject">

              <action class="com.cmp.fo3test.workflow.action.DeleteProjectHandler"></action>

              <transition to="endProjectManagementProcess" name="toEnd"></transition>

          </node>

         <end-state name="endProjectManagementProcess"></end-state>

      </process-definition>

       

      Exception:

      org.jbpm.graph.def.DelegationException

          at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:352)

          at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:346)

          at org.jbpm.graph.def.Node.execute(Node.java:333)

          at org.jbpm.graph.def.Node.enter(Node.java:316)

          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:173)

          at org.jbpm.graph.def.Node_$$_javassist_84.enter(Node_$$_javassist_84.java)

          at org.jbpm.graph.def.Transition.take(Transition.java:119)

          at org.jbpm.graph.def.Node.leave(Node.java:383)

          at org.jbpm.graph.node.StartState.leave(StartState.java:70)

          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:173)

          at org.jbpm.graph.def.Node_$$_javassist_84.leave(Node_$$_javassist_84.java)

          at org.jbpm.graph.exe.Token.signal(Token.java:178)

          at org.jbpm.graph.exe.Token.signal(Token.java:123)

          at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:217)

          at com.cmp.fo3test.bpm.AbstractFO3BPMTest.startProcessInstance(AbstractFO3BPMTest.java:142)

          at com.cmp.fo3test.bpm.AbstractProcessManagementBPMTest.startProjectManagementProcess(AbstractProcessManagementBPMTest.java:80)

          at com.cmp.fo3test.bpm.ProcessTest.testStartNotValidProjectProcess(ProcessTest.java:35)

          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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:81)

          at org.testng.internal.Invoker.invokeMethod(Invoker.java:673)

          at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:842)

          at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1166)

          at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)

          at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)

          at org.testng.TestRunner.runWorkers(TestRunner.java:1172)

          at org.testng.TestRunner.privateRun(TestRunner.java:757)

          at org.testng.TestRunner.run(TestRunner.java:608)

          at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)

          at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)

          at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)

          at org.testng.SuiteRunner.run(SuiteRunner.java:240)

          at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)

          at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)

          at org.testng.TestNG.runSuitesSequentially(TestNG.java:1158)

          at org.testng.TestNG.runSuitesSequentially(TestNG.java:1154)

          at org.testng.TestNG.runSuitesLocally(TestNG.java:1083)

          at org.testng.TestNG.run(TestNG.java:999)

          at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)

          at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:203)

          at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:174)

      Caused by: org.jbpm.JbpmException: can't leave node 'EndState(endProjectManagementProcess)' without leaving transition

          at org.jbpm.graph.def.Node.leave(Node.java:365)

          at org.jbpm.graph.def.Node.leave(Node.java:347)

          at org.jbpm.graph.exe.ExecutionContext.leaveNode(ExecutionContext.java:120)

          at com.cmp.fo3test.workflow.action.ValidateProjectHandler.execute(ValidateProjectHandler.java:57)

          at org.jbpm.graph.def.Action.execute(Action.java:123)

          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:173)

          at org.jbpm.graph.def.Action_$$_javassist_36.execute(Action_$$_javassist_36.java)

          at org.jbpm.graph.def.Node.execute(Node.java:328)

          ... 48 more

      org.jbpm.graph.def.DelegationException

          at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:352)

          at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:346)

          at org.jbpm.graph.def.Node.execute(Node.java:333)

          at org.jbpm.graph.def.Node.enter(Node.java:316)

          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:173)

          at org.jbpm.graph.def.Node_$$_javassist_84.enter(Node_$$_javassist_84.java)

          at org.jbpm.graph.def.Transition.take(Transition.java:119)

          at org.jbpm.graph.def.Node.leave(Node.java:383)

          at org.jbpm.graph.node.StartState.leave(StartState.java:70)

          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:173)

          at org.jbpm.graph.def.Node_$$_javassist_84.leave(Node_$$_javassist_84.java)

          at org.jbpm.graph.exe.Token.signal(Token.java:178)

          at org.jbpm.graph.exe.Token.signal(Token.java:123)

          at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:217)

          at com.cmp.fo3test.bpm.AbstractFO3BPMTest.startProcessInstance(AbstractFO3BPMTest.java:142)

          at com.cmp.fo3test.bpm.AbstractProcessManagementBPMTest.startProjectManagementProcess(AbstractProcessManagementBPMTest.java:80)

          at com.cmp.fo3test.bpm.ProcessTest.testStartNotValidProjectProcess(ProcessTest.java:35)

          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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:81)

          at org.testng.internal.Invoker.invokeMethod(Invoker.java:673)

          at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:842)

          at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1166)

          at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)

          at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)

          at org.testng.TestRunner.runWorkers(TestRunner.java:1172)

          at org.testng.TestRunner.privateRun(TestRunner.java:757)

          at org.testng.TestRunner.run(TestRunner.java:608)

          at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)

          at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)

          at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)

          at org.testng.SuiteRunner.run(SuiteRunner.java:240)

          at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)

          at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)

          at org.testng.TestNG.runSuitesSequentially(TestNG.java:1158)

          at org.testng.TestNG.runSuitesSequentially(TestNG.java:1154)

          at org.testng.TestNG.runSuitesLocally(TestNG.java:1083)

          at org.testng.TestNG.run(TestNG.java:999)

          at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)

          at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:203)

          at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:174)

      Caused by: org.jbpm.JbpmException: can't leave node 'EndState(endProjectManagementProcess)' without leaving transition

          at org.jbpm.graph.def.Node.leave(Node.java:365)

          at org.jbpm.graph.def.Node.leave(Node.java:347)

          at org.jbpm.graph.exe.ExecutionContext.leaveNode(ExecutionContext.java:120)

          at com.cmp.fo3test.workflow.action.ValidateProjectHandler.execute(ValidateProjectHandler.java:57)

          at org.jbpm.graph.def.Action.execute(Action.java:123)

          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:173)

          at org.jbpm.graph.def.Action_$$_javassist_36.execute(Action_$$_javassist_36.java)

          at org.jbpm.graph.def.Node.execute(Node.java:328)

          ... 48 more

       

      I will be glad if someone can tell whether there's something wrong with my process definition or should i handle further issues within java code and assign them to my process.

       

      Best Regards

        • 1. Re: JBPM 3.1 Exception thrown on EndState
          Al Daher Newbie

          i analysed the log Information, there was something suspicious happening in my process.

          The process cgoes as follows:

          Start---->validateNode(actionhandler1)---->decisionNodeUponValidation(actionhandler2)----->End\or go further

          in actionHandler1 ihad the following code:

          Line1 if(startDate.before(currentDate))

          Line2        {

          Line3            executionContext.setVariable(ProjectManagementProcessConstants.VAR_PROJECT_STATUS, Status.REJECTED);

          Line4            executionContext.leaveNode();

          Line5        }

          Line6        else if(projecttitle==null || projecttitle.equals(""))

          Line7        {

          Line8            executionContext.setVariable(ProjectManagementProcessConstants.VAR_PROJECT_STATUS, Status.REJECTED);

          Line9            executionContext.leaveNode();

          Line10        }

          Line11        executionContext.setVariable(ProjectManagementProcessConstants.VAR_PROJECT_STATUS, Status.APPROVED);

          Line12        executionContext.leaveNode();

           

          according my test, it shall go through line 3 and 4 and after that actionhandler2 shall be called and then to endState will be reached. So fas so good. And it happens indeed BUT:

          after getting out of End State the code completes to line 11 and 12 in actionHandler1. Now the Variable Status is has changed But actionHandler1 has not finished. So while leaving EndState it goes furrther in actionHandler1 and actionHandler2. in actionHandler2 it fires a a leavenode(transition1) and tries to go to a transition1 which does not exist in End State. Hence the exception can't leave node 'EndState(endProjectManagementProcess)' without leaving transition.

           

          Bottom Line: LEAVENODE FUNCTION IS NOT THE SAME AS RETURN

          That is something NEW AND INTERESTING to learn