Process-state: can't create a process instance when processD
ayang Oct 27, 2006 2:43 PMI'm trying a very simple example of sub-processes up and running with the following definitions:
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="sub"> <start-state name="start"> <transition name="" to="node"></transition> </start-state> <node name="node"> <transition name="" to="wait-state"></transition> </node> <end-state name="end"></end-state> <state name="wait-state"> <transition name="" to="end"></transition> </state> </process-definition>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="caller"> <start-state name="start"> <transition name="" to="node"></transition> </start-state> <end-state name="end"></end-state> <node name="node"> <transition name="" to="call sub"></transition> </node> <process-state name="call sub"> <sub-process name="sub"/> <transition name="" to="end"></transition> </process-state> </process-definition>
Excerpted from my unit test code:
context = _jbpmConfiguration.createJbpmContext(); FileInputStream fis_sub = new FileInputStream("processes/sub/processdefinition.xml"); FileInputStream fis_caller = new FileInputStream("processes/caller/processdefinition.xml"); ProcessDefinition pdload_sub = ProcessDefinition.parseXmlInputStream(fis_sub); ProcessDefinition pdload_caller = ProcessDefinition.parseXmlInputStream(fis_caller); context.deployProcessDefinition(pdload_sub); context.deployProcessDefinition(pdload_caller); GraphSession gs_caller = context.getGraphSession(); // don't think I necessarily need to reload the process definitions // from the session but it doesn't make a difference ProcessDefinition pd_sub = gs_caller.findLatestProcessDefinition("sub"); ProcessDefinition pd_caller = gs_caller.findLatestProcessDefinition("caller"); ProcessInstance inst = new ProcessInstance(pd_caller); // begin Token token = inst.getRootToken(); ContextInstance contextInst = (ContextInstance) inst.getInstance(ContextInstance.class); System.out.println("getNode().getName(): " + token.getNode().getName()); token.signal(); System.out.println("getNode().getName(): " + token.getNode().getName()); } finally { context.close(); }
The process runs successfully until it tries to invoke the sub-process (when I signal the calling process) at which point I get the NullPointerException
I'm sure it's something very simple - any thoughts?
Thanks,
Andy