[jboss-user] [JBoss jBPM] - Re: How to define a process definition that has multiples su

faite do-not-reply at jboss.com
Tue Dec 16 11:12:38 EST 2008


I changed the process definition 

<process-definition  xmlns="urn:jbpm.org:jpdl-3.2"  name="listingloads">
  | 	<start-state name="load new file">
  | 		<transition to="fork1">
  | 		</transition>
  | 	</start-state>
  | 	<node name="fork1">
  | 		<action class="com.ldg.bpm.handler.fork.ForEachForkActionHandler">
  | 		</action>
  | 		<transition to="process-state2"></transition>
  | 	</node>
  | 	<process-state name="process-state2">
  | 		<sub-process name="processlistings"/>
  | 		<transition to="join1"></transition>
  | 	</process-state>
  | 	<join name="join1">
  | 		<transition to="end"></transition>
  | 	</join>
  | 	<end-state name="end"></end-state>
  | </process-definition>

Action
*********
   public void execute(final ExecutionContext executionContext) throws Exception 
  |     {
  |         final Token rootToken = executionContext.getToken();
  |         final Node node = executionContext.getNode();
  |         final List argSets = new LinkedList();
  |         
  |         for (int i = 0; i < node.getLeavingTransitions().size(); i++) {
  |             final Transition transition = (Transition) node.getLeavingTransitions().get(0);
  | 
  |             for (int j = 0; j < 2; j++) {
  | 
  |                 final Token newToken = new Token(rootToken, FOREACH_PREFIX + node.getId() + "." + j);
  |                 
  |                 newToken.setTerminationImplicit(true);
  |                 executionContext.getJbpmContext().getSession().save(newToken);
  |                 
  |                 final ExecutionContext newExecutionContext = new ExecutionContext( newToken );
  |                 newExecutionContext.getContextInstance().createVariable( "message", "data " + j, newToken);               
  |                 argSets.add(new Object[] {newExecutionContext, transition});
  |             }
  |         }
  | 
  |         for (int i = 0; i < argSets.size(); i++) 
  |         {
  |             final Object[] args = (Object[]) argSets.get(i);
  |             node.leave((ExecutionContext) args[0], (Transition) args[1]);
  |         }
  |     }

And I get this error

11:08:45,020 ERROR [GraphElement] action threw exception: can't create a process instance when processDefinition is null
  | org.jbpm.JbpmException: can't create a process instance when processDefinition is null
  | 	at org.jbpm.graph.exe.ProcessInstance.<init>(ProcessInstance.java:129)
  | 	at org.jbpm.graph.exe.ProcessInstance.<init>(ProcessInstance.java:93)
  | 	at org.jbpm.graph.exe.Token.createSubProcessInstance(Token.java:621)
  | 	at org.jbpm.graph.node.ProcessState.execute(ProcessState.java:146)
  | 	at org.jbpm.graph.def.Node.enter(Node.java:314)
  | 	at sun.reflect.GeneratedMethodAccessor281.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
  | 	at org.jbpm.graph.def.Node_$$_javassist_49.enter(Node_$$_javassist_49.java)
  | 	at org.jbpm.graph.def.Transition.take(Transition.java:151)
  | 	at org.jbpm.graph.def.Node.leave(Node.java:389)
  | 	at com.ldg.bpm.handler.fork.ForEachForkActionHandler.execute(ForEachForkActionHandler.java:52)

Could you help me to fix this?
Thanks

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4196925#4196925

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4196925



More information about the jboss-user mailing list