[jboss-user] [JBoss jBPM] - problem loading a persisted processInstance. The data obtein
martin84
do-not-reply at jboss.com
Thu Mar 13 13:55:33 EDT 2008
hi, i have a problem with jbpm when i am trying to load a workflow which is persisted in the db (postgres).
When I obtain from the database the processInstance that I want to continue executing, inside of the rootToken atribute, all the atributes are null.
In fact, when execute the signal method to this state, an error listed in the button of the message is obtained.
this code is the method where the processInstance is persisted on the db
| public ProcessInstance saveProcessInstance(String workFlowId, long dProcessInstance,ContextSolver context) {
| try{ if (jbpmContext!= null && jbpmContext.getSession().isOpen())
| jbpmContext.close();
| }catch (Exception e)
| { e.printStackTrace(); }
| jbpmConfiguration = JbpmConfiguration.getInstance();
| jbpmContext = jbpmConfiguration.createJbpmContext();
| ProcessDefinition processDefinition = repository.getWorkflows().get(workFlowId).getProcessDefinition();
| try {
| GraphSession graphSession = jbpmContext.getGraphSession();
| processDefinition = graphSession.findLatestProcessDefinition(workFlowId);
|
| if (processDefinition==null){
| processDefinition=repository.getWorkflows().get(workFlowId).getProcessDefinition();
| jbpmContext.deployProcessDefinition(processDefinition);
| }
|
| Map mapa=processDefinition.getDefinitions();
| ProcessInstance processInstance=jbpmContext.newProcessInstance(processDefinition.getName());
| //add the context variables processInstance.getContextInstance().addVariables(context.getVariables());
|
|
| processInstance.getTaskMgmtInstance().createTaskInstance();
|
|
| long processInstanceId = processInstance.getId();
|
|
|
| if (processDefinition != null){
| processInstance = jbpmContext.loadProcessInstance(processInstanceId);
| }
|
|
| return processInstance;
| } finally {
| jbpmContext.close();
| }
| }
|
|
|
this code is the method where i get the persisted workflow of the db
|
| public FBActionResult reloadPending(long id_instance,String workFlowId,String layout,String coreResultCode,FBSessionInfo sessionInfo){
| try {
| if (jbpmContext!= null && jbpmContext.getSession().isOpen())
| jbpmContext.close(); }
| catch (Exception e) {
| e.printStackTrace(); }
|
|
| ProcessDefinition processDefinition;
| jbpmConfiguration = JbpmConfiguration.getInstance();
| jbpmContext = jbpmConfiguration.createJbpmContext();
|
| try {
| GraphSession graphSession = jbpmContext.getGraphSession();
| processDefinition = graphSession.findLatestProcessDefinition(workFlowId);
|
| ProcessInstance processInstance = jbpmContext.getProcessInstance(id_instance);
| this.processInstance=processInstance;
|
|
| this.processInstance.setProcessDefinition(processDefinition);
| Map result =processInstance.getContextInstance().getVariables();
|
| ContextSolver context = new ContextSolver(result);
|
| State estado = getRepository().getWorkflowOnDemand(workFlowId).getState(layout);
|
|
| String nextLayoutId;
| nextLayoutId = estado.getLayout();
|
| WorkFlowState nextWorkFlowState = new WorkFlowState(workFlowId,
| nextLayoutId, nextLayoutId);
|
| return new FBActionResult(coreResultCode, context.getVariables(), nextWorkFlowState);
|
| } finally {
|
| jbpmContext.close();
| }
| }
|
When i execute processInstance.signal(estado); over the process instance obtained in reloadPending method, where estado is a transition of the corresponding state, the following error is displayed:
|
| org.jbpm.JbpmException: couldn't signal token 'Token(/)' : node 'StartState(start)' doesn't have a transition 'nextState'
| at org.jbpm.graph.exe.Token.signal(Token.java:139)
| at org.jbpm.graph.exe.Token$$FastClassByCGLIB$$74df1c6e.invoke(<generated>)
| at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
| at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:161)
| at org.jbpm.graph.exe.Token$$EnhancerByCGLIB$$6080eb93.signal(<generated>)
| at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:229)
| at com.modhelus.fastbranch.server.FBServer.executeAction(FBServer.java:426)
| at com.modhelus.fastbranch.server.socketserver.ExecuteActionFBCommandResolver.execute(ExecuteActionFBCommandResolver.java:36)
| at com.modhelus.fastbranch.server.socketserver.FBServerSession.processRequest(FBServerSession.java:190)
| at com.modhelus.fastbranch.server.socketserver.FBServerSession.run(FBServerSession.java:136)
| at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
| at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
| at java.lang.Thread.run(Thread.java:595)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4136417#4136417
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4136417
More information about the jboss-user
mailing list