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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.