How to set process variable ?

Solution Unverified - Updated -

Issue

We are trying to set process variable like as:

WorkflowProcessInstance wfpi = (WorkflowProcessInstance) pi;
wfpi.setVariable( "Variable", "1234" );

but it fails with below error:

Exception in thread "main" java.lang.RuntimeException: Process instance 3[com.sample.bpmn.hello] is disconnected.
    at org.jbpm.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:90)
    at org.jbpm.process.instance.impl.ProcessInstanceImpl.getContextInstance(ProcessInstanceImpl.java:161)
    at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setVariable(WorkflowProcessInstanceImpl.java:268)
    at com.sample.ProcessMainSetVariable.main(ProcessMainSetVariable.java:50)

Environment

  • Red Hat JBoss BRMS
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In