2 Replies Latest reply on Mar 9, 2015 3:22 AM by Kenneth Tanguilig

    JBPM5.4 transactions to use the current MDB context user transaction

    Kenneth Tanguilig Newbie

      Hi All!

       

      I'm currently doing a project in Spring 3, Hibernate 4 and JBPM5.4 running in WebSphere 7. I'm starting my process inside a Message Driven Bean and inside this bean I'm sending another JMS to trigger another Message Driven Bean to continue the process by another Message Driven Bean. Before starting the process, I am beginning the MessageDrivenContext user transaction and committing it right after my JBPM process is executed. It goes something like this:

       

      MDBAbstractMessageBean {

      MessageDrivenContext context = null;

       

      UserTransaction ut = context.getUserTransaction();

      ut.begin();

      //start JBPM processing

      processMessage();

      ut.commit();

      }

       

      One session per process instance is the implementation I used. Everything is well when I'm running a simple process that only triggers 3 Message Driven Beans. The issue comes when I'm trying to run multiple Message Driven Beans. I'm getting StaleStateObject exceptions in ProcessInstanceInfo randomly. My assumption is that the transaction used by the JBPM5.4 engine is not in-synced with the Message Driven Bean's user transaction. Since it is a long running process, I'm thinking that a trigger to the next bean has already started (getting the previous process instance info) but JBPM 5.4 transaction has not yet committed the changes. Is this the case? If my assumption is correct, are there any ways on how I can force JBPM5.4 user transactions to use the current Message Driven Bean's user transaction so that all changes are committed by both the application and JBPM5.4 transactions during the ut.commit() method (application triggers the next bean, JBPM5.4 changes are also comitted so the next Message Driven Bean is sure that there will be no locking exceptions inside the JBPM engine when the next Message Driven bean is started).

       

      Thanks in advance for your help!