sub process call from jbpm api
pisecs2982 Jan 19, 2010 7:07 AMI am trying to invoke a simple sub process from a main process using the below mentioned code using jbpm-jpdl-3.2.3:
public class TestSubProcess implements ActionHandler{
Token superProcessToken = executionContext.getToken();
ProcessDefinition subProcessDefinition = ProcessDefinition
.parseParZipInputStream(zipInputStream);
ProcessInstance subProcessInstance = superProcessToken.createSubProcessInstance(subProcessDefinition);
subPorcessInstance.getRootToken().signal();
}
I have a very simple sub process mentioned below:
<process-definition xmlns="" name="user_sub_process">
<start-state>
<transition to="CustomComp" />
</start-state>
<node name="CustomComp">
<action class="com.cts.action.CustomAction" />
<transition to="end" />
</node>
<end-state name="end" />
</process-definition>
This my CustomAction class in sub process .
public class CustomAction implements ActionHandler {
/**
* long serialVersionUID
*/
private static final long serialVersionUID = 1L;
private static final Logger log = Logger.getLogger(CustomAction.class
.getName());
public void execute(ExecutionContext executionContext) throws Exception {
log.info("executing custom node:::");
executionContext.leaveNode();
}
}
It executes the custom node (that is it fires the sub process) and then gives the exception.
ERROR [GraphElement] - action threw exception: couldn't signal without specifying a leaving transition : transition is null
org.jbpm.JbpmException: couldn't signal without specifying a leaving transition : transition is null
at org.jbpm.graph.exe.Token.signal(Token.java:173)
at org.jbpm.graph.exe.Token.signal(Token.java:168)
at org.jbpm.graph.exe.ProcessInstance.end(ProcessInstance.java:322)
at org.jbpm.graph.exe.Token.notifyParentOfTokenEnd(Token.java:329)
at org.jbpm.graph.exe.Token.end(Token.java:301)
at org.jbpm.graph.exe.Token.end(Token.java:251)
at org.jbpm.graph.node.EndState.execute(EndState.java:59)
at org.jbpm.graph.def.Node.enter(Node.java:318)
at org.jbpm.graph.def.Transition.take(Transition.java:151)
at org.jbpm.graph.def.Node.leave(Node.java:393)
at org.jbpm.graph.def.Node.leave(Node.java:357)
at org.jbpm.graph.exe.ExecutionContext.leaveNode(ExecutionContext.java:120)
at com.cts.action.CustomAction.execute(CustomAction.java:18)
It seems that jbpm is trying to force a transition after reaching the end state.I am not sure that why it is trying to signal after reaching the end state.
The same thing works if I do this in the main process that is by using process state:
<process-state name="process-state">
<sub-process name="user_sub_process" binding="late"></sub-process>
<transition to="end"></transition>
</process-state>
I am not sure that what am I doing wrong out here.