0 Replies Latest reply on Sep 17, 2007 12:33 PM by Andreas Mavrides

    org.hibernate.event.def.AbstractFlushingEventListener] Could

    Andreas Mavrides Newbie

      Hi, I am using JBPM 3.2.2 under JBOSS 4.0.5GA and Hibernate (default JBOSS 4.0.5GA database).
      I have a very simple process definition, in which I have a fork and a join and I want all nodes to be asynchronous. I have noticed that when I declare the two nodes between the fork/join as asynchronous I get this exception on the stack trace:

      INFO [com.sample.action.DummyTwoActionHandler] Node Name: node1
      INFO [com.sample.action.DummyTwoActionHandler] Node Name: node3
      INFO [com.sample.action.DummyTwoActionHandler] Node Name: node2
      ERROR [org.hibernate.event.def.AbstractFlushingEventListener] Could not synchronize database state with session
      org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.graph.exe.Token#874]
       at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1699)
       at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2342)
       at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2242)
       at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2542)
       at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:92)
       at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
       at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
       at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
       at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:59)
       at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1491)
       at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1110)
       at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:324)
       at org.jboss.tm.TxManager.commit(TxManager.java:240)
       at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:351)
       at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:905)
       at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:170)
       at org.jboss.mq.SpySession.run(SpySession.java:323)
       at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:194)
       at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
       at java.lang.Thread.run(Thread.java:619)
      2007-09-17 17:16:59,171 ERROR [org.jboss.jms.asf.StdServerSession] failed to commit/rollback
      org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=emma/36, BranchQual=, localId=36] status=STATUS_NO_TRANSACTION; - nested throwable: (org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.graph.exe.Token#874])
       at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:372)
       at org.jboss.tm.TxManager.commit(TxManager.java:240)
       at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:351)
       at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:905)
       at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:170)
       at org.jboss.mq.SpySession.run(SpySession.java:323)
       at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:194)
       at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
       at java.lang.Thread.run(Thread.java:619)
      Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.graph.exe.Token#874]
       at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1699)
       at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2342)
       at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2242)
       at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2542)
       at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:92)
       at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
       at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
       at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
       at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:59)
       at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1491)
       at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1110)
       at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:324)
       ... 8 more


      I am not sure whether this is a bug of JBPM 3.2.2 but it only happens when I declare any nodes that exist between a fork/join as asynchronous. Here is my process definition:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <process-definition
       xmlns="urn:jbpm.org:jpdl-3.2" name="AsyncProcessFork">
       <start-state name="start">
       <transition name="" to="node1"></transition>
       </start-state>
       <node name="node1" async='true'>
       <action class="com.sample.action.DummyTwoActionHandler"></action>
       <transition name="" to="fork1"></transition>
       </node>
       <fork name="fork1">
       <transition name="" to="node2"></transition>
       <transition name="tr2" to="node3"></transition>
       </fork>
       <join name="join1">
       <transition name="" to="node4"></transition>
       </join>
       <node name="node2" async='true'>
       <action class="com.sample.action.DummyTwoActionHandler"></action>
       <transition name="" to="join1"></transition>
       </node>
       <node name="node3" async='true'>
       <action class="com.sample.action.DummyTwoActionHandler"></action>
       <transition name="" to="join1"></transition>
       </node>
       <end-state name="end1"></end-state>
       <node name="node4" async='true'>
       <action class="com.sample.action.DummyTwoActionHandler"></action>
       <transition name="" to="end1"></transition>
       </node>
      </process-definition>


      And here is my DummyActionHandler which just goes to the next node:

      public class DummyTwoActionHandler implements ActionHandler {
      
       static Logger log;
      
       public void execute(ExecutionContext executionContext) throws Exception {
      
       log = Logger.getLogger(this.getClass());
      
       log.info("Node Name: " + executionContext.getNode().getName());
      
       executionContext.getNode().leave(executionContext);
       }
      
      }
      


      I would be really grateful for any help on this matter.