10 Replies Latest reply on Feb 16, 2009 7:36 AM by Ronald van Kuijk

    Jbpm 3.3.1 Timer Exception on executionContext.leaveNode()

    David Roberts Apprentice

      Hi,

      In Jbpm 3.2.x, I never had this problem. But I recently upgraded to Jbpm 3.3.1, and now, on a State Node, if I have a timer set which repeats, and on the timers action I call executionContext.leaveNode(), I get an exception. If my timer is not set to repeat, I don't get the exception. This is a bit of a showstopper for me. Any ideas would be appreciated?

      Here is my simple process definition:

      <process-definition
       xmlns="urn:jbpm.org:jpdl-3.2" name="ITD Sick Leave">
       <swimlane name="Initiator"></swimlane>
       <start-state name="Record Sick Leave">
       <transition to="Wait for Tomorrow"></transition>
       </start-state>
      
      
       <state name="Wait for Tomorrow">
       <timer duedate="5 seconds" name="Wait for Tomorrow" repeat="5 seconds">
       <action class="za.co.workflow.itdsickleave.action.WaitForTomorrow"></action>
       </timer>
       <transition to="Complete"></transition>
       </state>
      
      
       <end-state name="Complete"></end-state>
      </process-definition>


      Here is my action's execute method attached to the timer:
      public void handle(ExecutionContext executionContext) throws Exception {
       executionContext.leaveNode();
       }


      Here is the exception being thrown:
      INFO JbpmJobExecutor:10.11.5.61:1 org.jbpm.persistence.db.DbPersistenceService - problem committing transaction: optimistic locking failed
      INFO JbpmJobExecutor:10.11.5.61:1 org.jbpm.svc.Services - problem closing service 'persistence': optimistic locking failed
      ERROR JbpmJobExecutor:10.11.5.61:1 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.job.Timer#2480]
       at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1765)
       at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2407)
       at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2307)
       at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2607)
       at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:92)
       at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142)
       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.JDBCTransaction.commit(JDBCTransaction.java:106)
       at org.jbpm.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:266)
       at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:222)
       at org.jbpm.svc.Services.close(Services.java:294)
       at org.jbpm.JbpmContext.close(JbpmContext.java:136)
       at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:190)
       at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:60)