5 Replies Latest reply on Mar 4, 2013 8:37 AM by obon

    calling the setVariable on reloaded ProcessInstance leads to NullPointerException

    Newbie

      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