JBoss Community

calling the setVariable on reloaded ProcessInstance leads to NullPointerException

created by Oleg Bondarenko in jBPM - View the full discussion

Hi,

 

at some point in my application I reload my session:

 

JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId, kbase, config, env);

 

then my process instance:

 

WorkflowProcessInstance processInstance = (WorkflowProcessInstance) ksession.getProcessInstance(processInstanceId);

 

and then try to set a process variable:

 

processInstance.setVariable(name, value)

 

which fails :

java.lang.NullPointerException

    at org.jbpm.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:68)

    at org.jbpm.process.instance.impl.ProcessInstanceImpl.getContextInstance(ProcessInstanceImpl.java:133)

    at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setVariable(WorkflowProcessInstanceImpl.java:238)

    ...

 

The reason is: the variable InternalKnowledgeRuntime kruntime in ProcessInstanceImpl is null.

 

Is it a bug or is there another way to load the process instance?

 

Regards,

Oleg

Reply to this message by going to Community

Start a new discussion in jBPM at Community