3 Replies Latest reply on Jan 3, 2007 9:33 AM by David Hosier

    Simple process not ending.

    Sergio Ramos Newbie

      I execute my business process using the following code:


      GraphSession graphSession = jbpmContext.getGraphSession();
      log.debug("Finding process definition: MyProcess");
      ProcessDefinition processDefinition = graphSession.findLatestProcessDefinition
      log.debug("Creating new process instance: MyProcess");
      ProcessInstance processInstance = new ProcessInstance(processDefinition);
      log.debug("Saving process instance: MyProcess");

      og.debug("Executing business process: MyProcess");
      log.debug("Is process ended? " + processInstance.hasEnded());
      log.debug("Saving process instance: MyProcess");

      String status = (String) processInstance.getContextInstance().getVariable(PVAR_engineStatus);
      log.info("return=" + status);

      My code here and the code in the node action in my business process execute successfully, without any errors. However, the problem is that the process shows that it has not ended -- the processInstance.hasEnded() method returns false, and the process instance saved to the database also shows that the process has not yet ended. Again, there are no wait states in this business process, and there are transitions from start to my node to the end. Why isn't my business process showing that it has ended?

      Thanks in advance.

        • 1. Re: Simple process not ending.
          David Hosier Novice

          Make sure you are leaving the node in your action code. You should have something like executionContext.leaveNode() at the end of your action code.

          • 2. Re: Simple process not ending.
            Sergio Ramos Newbie

            Thanks for your reply, now I use 'ExecutionContext.leaveNode' at the end of the action, but i have the following error:

            at org.jbpm.graph.exe.ExecutionContext.leaveNode(ExecutionContext.java:128)
            at org.jbpm.pruebasTutorial.MyActionHandler.execute(MyActionHandler.java:44)
            at org.jbpm.graph.def.Action.execute(Action.java:123)
            at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:235)
            at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:212)
            at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:182)
            at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:166)
            at org.jbpm.graph.def.Transition.take(Transition.java:106)

            Do you know the cause of this error?

            Thanks in advance

            • 3. Re: Simple process not ending.
              David Hosier Novice

              You should post the code to your ActionHandler.