Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created 
the discussion

"Re: TwoPhaseCoordinator.beforeCompletion - Unknown node instance type"

To view the discussion, visit: https://community.jboss.org/message/764319#764319

--------------------------------------------------------------
I think that the cause fo the problem is:
Caused by: java.lang.NullPointerException
    at 
org.jbpm.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:68)

that indicates you should use command to set the variables, try with following 
code:

GenericCommand<Void> setProcInstVariablesCommand = new GenericCommand<Void>() {
            public Void execute(Context context) {
                StatefulKnowledgeSession ksession = ((KnowledgeCommandContext) 
context).getStatefulKnowledgesession();
                ProcessInstance processInstance = 
ksession.getProcessInstance(new Long(processInstanceId));
                if (processInstance != null) {
                    VariableScopeInstance variableScope = 
(VariableScopeInstance) 
                        ((org.jbpm.process.instance.ProcessInstance) 
processInstance)
                            .getContextInstance(VariableScope.VARIABLE_SCOPE);
                    if (variableScope == null) {
                        throw new IllegalArgumentException(
                            "Could not find variable scope for process instance 
" + processInstanceId);
                    }
                    for (Map.Entry<String, Object> entry: variables.entrySet()) 
{
                        variableScope.setVariable(entry.getKey(), 
entry.getValue());
                    }
                } else {
                    throw new IllegalArgumentException("Could not find process 
instance " + processInstanceId);
                }
                return null;
            }
        };
 
ksession.execute(setProcInstVariablesCommand);



HTH
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/764319#764319]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to