How to start new process instance from custom WorkItemHandler in JBoss BPM Suite 6 ?

Solution Unverified - Updated -


In custom workItemHandler we are using below code to start new process instance, but it fails with exception:

//execute method:   
long processInstanceId = workItem.getProcessInstanceId();
ProcessInstance ins = kSession.getProcessInstance(processInstanceId);
String processId = ins.getProcessId();      
ProcessInstance procInstance = kSession.startProcess(processId, null);
long newProcessInstanceId = procInstance.getId();


. . .
Caused by: java.lang.IllegalStateException: KieSession with id 12 is already used by another context
    at org.jbpm.runtime.manager.impl.PerProcessInstanceRuntimeManager.validate( [jbpm-runtime-manager-6.2.0.Final-redhat-4.jar:6.2.0.Final-redhat-4]
    at org.jbpm.persistence.processinstance.JPAProcessInstanceManager.getProcessInstance( [jbpm-persistence-jpa-6.2.0.Final-redhat-4.jar:6.2.0.Final-redhat-4]
. . .


  • Red Hat JBoss BPM Suite
    • 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

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content