[jboss-user] [jBPM] - Re: TwoPhaseCoordinator.beforeCompletion - Unknown node instance type

Maciej Swiderski do-not-reply at jboss.com
Thu Oct 11 05:59:27 EDT 2012


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]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20121011/59fc32aa/attachment.html 


More information about the jboss-user mailing list