[jboss-user] [JBoss Seam] - jbpm timer duedate causes StaleObjectStateException

pbrewer_uk do-not-reply at jboss.com
Mon Feb 11 06:51:07 EST 2008


I have a state node that requires a specific time be set (e.g. at 16:00 instead of 3 hours from now). I can achieve this via the following:

jpdl code:

  |    <state name="Buffer period">
  |      <event type="timer-create">
  |        <action expression="#{orderFulfillmentWorkflow.setBufferDueDate}" />
  |      </event>
  |      <timer duedate="12 hours">
  |         <action expression="#{orderFulfillmentWorkflow.progress}" />
  |      </timer>
  |      <transition name="bufferPeriodTimeout" to="Is order valid?"></transition>
  |    </state>
  | 

java (seam) code:

  |   public void setBufferDueDate() {
  |     Timer timer = ExecutionContext.currentExecutionContext().getTimer() ;
  |     if (timer != null) {
  |       // 3 min in future for test purposes...
  |       Date bufferDueDate = new Date( now.getTime() + 180000 )
  |       getLog().debug("Buffer due to expire on #0", bufferDueDate) ;
  | 
  |       timer.setDueDate(bufferDueDate) ;
  | 
  |     } else {
  |       getLog().error("No timer was available.") ;
  |     }
  | 
  |   }
  | 
  |   public void progress() {
  |     ExecutionContext.currentExecutionContext().leaveNode() ;
  |   }
  | 

The timer then fires at the time I set and the workflow then progresses until the end (or hits a wait state). At that point, the following exception is logged and the workflow is not saved:


  | 2008-02-11 11:05:02,412 DEBUG [org.jbpm.svc.save.CascadeSaveOperation] cascading save of 'org.jbpm.graph.exe.ProcessInstance at 1090b29'
  | 2008-02-11 11:05:02,412 DEBUG [org.jbpm.svc.save.CascadeSaveOperation] cascading save to process instance 'org.jbpm.graph.exe.ProcessInstance at 14a7b0c'
  | 2008-02-11 11:05:02,412 DEBUG [org.jbpm.svc.Services] executing default save operations
  | 2008-02-11 11:05:02,412 DEBUG [org.jbpm.svc.save.HibernateSaveOperation] saving process instance
  | 2008-02-11 11:05:02,412 DEBUG [org.jbpm.svc.save.SaveLogsOperation] flushing logs to logging service.
  | 2008-02-11 11:05:02,412 DEBUG [org.jbpm.svc.save.CascadeSaveOperation] cascading save of 'org.jbpm.graph.exe.ProcessInstance at 14a7b0c'
  | 2008-02-11 11:05:02,412 DEBUG [org.jbpm.db.JobSession] deleting timer(Buffer period,08-02-11 11:05:00,653,Token: 90)
  | 2008-02-11 11:05:02,412 DEBUG [org.jbpm.JbpmContext] closing jbpmContext org.jbpm.JbpmContext at 108d20b
  | 2008-02-11 11:05:02,412 DEBUG [org.jbpm.svc.Services] closing service 'persistence': org.jbpm.persistence.db.DbPersistenceService at 108d348
  | 2008-02-11 11:05:02,427 DEBUG [org.jbpm.persistence.db.DbPersistenceService] flushing hibernate session SessionImpl(PersistenceContext[entityKeys=[EntityKey[org.jbpm.graph.log.SignalLog#1411], EntityKey[org.jbpm.graph.log.ProcessInstanceEndLog#1410], EntityKey[org.jbpm.graph.log.TransitionLog#1413], EntityKey[org.jbpm.graph.log.ProcessStateLog#1412], EntityKey[org.jbpm.graph.log.ActionLog#1407], EntityKey[org.jbpm.graph.def.ProcessDefinition#996], EntityKey[org.jbpm.graph.log.TransitionLog#1406], EntityKey[org.jbpm.context.log.variableinstance.StringUpdateLog#1409], EntityKey[org.jbpm.context.log.VariableCreateLog#1408], EntityKey[org.jbpm.graph.log.TransitionLog#1403], EntityKey[org.jbpm.graph.log.NodeLog#1402], EntityKey[org.jbpm.graph.log.NodeLog#1405], EntityKey[org.jbpm.graph.log.ActionLog#1404], EntityKey[org.jbpm.graph.log.ActionLog#1399], EntityKey[org.jbpm.graph.log.ActionLog#1398], EntityKey[org.jbpm.graph.log.TransitionLog#1401], EntityKey[org.jbpm.graph.log.NodeLog#1400], EntityKey[org.jbpm.graph.def.Action#5456], EntityKey[org.jbpm.graph.exe.ProcessInstance#56], EntityKey[org.jbpm.graph.def.Event#2346], EntityKey[org.jbpm.graph.def.Event#2345], EntityKey[org.jbpm.graph.def.Event#2348], EntityKey[org.jbpm.graph.exe.ProcessInstance#55], EntityKey[org.jbpm.graph.def.Action#5445], EntityKey[org.jbpm.graph.def.Action#5447], EntityKey[org.jbpm.graph.def.Action#5442], EntityKey[org.jbpm.graph.def.Action#5444], EntityKey[org.jbpm.graph.def.Transition#16612], EntityKey[org.jbpm.graph.def.Transition#16611], EntityKey[org.jbpm.context.exe.TokenVariableMap#55], EntityKey[org.jbpm.context.exe.TokenVariableMap#56], EntityKey[org.jbpm.graph.def.Transition#16603], EntityKey[org.jbpm.graph.def.Event#2353], EntityKey[org.jbpm.context.log.variableinstance.StringUpdateLog#1418], EntityKey[org.jbpm.graph.log.ProcessInstanceEndLog#1419], EntityKey[org.jbpm.graph.log.ActionLog#1416], EntityKey[org.jbpm.context.log.VariableCreateLog#1417], EntityKey[org.jbpm.graph.log.NodeLog#1414], EntityKey[org.jbpm.context.def.VariableAccess#3131], EntityKey[org.jbpm.graph.log.TransitionLog#1415], EntityKey[org.jbpm.context.def.VariableAccess#3130], EntityKey[org.jbpm.graph.exe.Token#89], EntityKey[org.jbpm.graph.exe.Token#90], EntityKey[org.jbpm.graph.def.Node#12781], EntityKey[org.jbpm.graph.def.Node#12787], EntityKey[org.jbpm.graph.def.Transition#16569], EntityKey[org.jbpm.graph.def.Transition#16570], EntityKey[org.jbpm.graph.def.Transition#16571], EntityKey[org.jbpm.graph.exe.Token#87], EntityKey[org.jbpm.graph.def.Transition#16572], EntityKey[org.jbpm.job.Job#26], EntityKey[org.jbpm.graph.exe.Token#88], EntityKey[org.jbpm.taskmgmt.exe.TaskInstance#56], EntityKey[org.jbpm.graph.node.State#12758], EntityKey[org.jbpm.graph.def.Node#12759], EntityKey[org.jbpm.graph.def.Node#12760], EntityKey[org.jbpm.graph.def.Node#12762], EntityKey[org.jbpm.module.exe.ModuleInstance#109], EntityKey[org.jbpm.module.exe.ModuleInstance#110], EntityKey[org.jbpm.context.exe.variableinstance.StringInstance#120], EntityKey[org.jbpm.context.exe.variableinstance.StringInstance#119], EntityKey[org.jbpm.context.exe.VariableInstance#118], EntityKey[org.jbpm.context.exe.VariableInstance#117], EntityKey[org.jbpm.module.exe.ModuleInstance#111], EntityKey[org.jbpm.module.exe.ModuleInstance#112], EntityKey[org.jbpm.context.exe.VariableInstance#116], EntityKey[org.jbpm.context.exe.VariableInstance#115], EntityKey[org.jbpm.graph.def.ProcessDefinition#997], EntityKey[org.jbpm.graph.def.Node#12789]],collectionKeys=[CollectionKey[org.jbpm.graph.def.ProcessDefinition.events#996], CollectionKey[org.jbpm.graph.exe.Token.children#87], CollectionKey[org.jbpm.graph.node.ProcessState.variableAccesses#12781], CollectionKey[org.jbpm.graph.def.ProcessDefinition.events#997], CollectionKey[org.jbpm.graph.def.Transition.exceptionHandlers#16603], CollectionKey[org.jbpm.graph.exe.Token.children#90], CollectionKey[org.jbpm.graph.exe.Token.children#89], CollectionKey[org.jbpm.graph.exe.Token.children#88], CollectionKey[org.jbpm.graph.def.Transition.exceptionHandlers#16611], CollectionKey[org.jbpm.graph.def.Node.leavingTransitions#12781], CollectionKey[org.jbpm.graph.def.Node.leavingTransitions#12787], CollectionKey[org.jbpm.graph.def.Node.arrivingTransitions#12781], CollectionKey[org.jbpm.graph.def.Transition.events#16603], CollectionKey[org.jbpm.graph.def.Node.leavingTransitions#12789], CollectionKey[org.jbpm.graph.def.Node.arrivingTransitions#12789], CollectionKey[org.jbpm.graph.def.Transition.events#16612], CollectionKey[org.jbpm.graph.def.Transition.events#16611], CollectionKey[org.jbpm.graph.def.Node.arrivingTransitions#12787], CollectionKey[org.jbpm.context.exe.ContextInstance.tokenVariableMaps#111], CollectionKey[org.jbpm.graph.def.Event.actions#2345], CollectionKey[org.jbpm.graph.def.Node.arrivingTransitions#12762], CollectionKey[org.jbpm.graph.def.Event.actions#2348], CollectionKey[org.jbpm.graph.def.Event.actions#2346], CollectionKey[org.jbpm.graph.def.Event.actions#2353], CollectionKey[org.jbpm.taskmgmt.exe.TaskMgmtInstance.taskInstances#110], CollectionKey[org.jbpm.graph.def.Transition.events#16570], CollectionKey[org.jbpm.graph.def.Transition.exceptionHandlers#16612], CollectionKey[org.jbpm.graph.def.Transition.events#16569], CollectionKey[org.jbpm.graph.def.Transition.events#16572], CollectionKey[org.jbpm.graph.def.Transition.events#16571], CollectionKey[org.jbpm.graph.exe.Token.comments#88], CollectionKey[org.jbpm.graph.def.Node.arrivingTransitions#12760], CollectionKey[org.jbpm.graph.def.Node.arrivingTransitions#12759], CollectionKey[org.jbpm.graph.exe.Token.comments#87], CollectionKey[org.jbpm.graph.def.Node.arrivingTransitions#12758], CollectionKey[org.jbpm.graph.exe.Token.comments#90], CollectionKey[org.jbpm.graph.exe.Token.comments#89], CollectionKey[org.jbpm.graph.def.ProcessDefinition.nodes#996], CollectionKey[org.jbpm.graph.def.ProcessDefinition.nodes#997], CollectionKey[org.jbpm.context.exe.ContextInstance.tokenVariableMaps#109], CollectionKey[org.jbpm.graph.def.ProcessDefinition.exceptionHandlers#996], CollectionKey[org.jbpm.graph.def.ProcessDefinition.exceptionHandlers#997], CollectionKey[org.jbpm.taskmgmt.exe.TaskInstance.pooledActors#56], CollectionKey[org.jbpm.graph.node.Decision.decisionConditions#12760], CollectionKey[org.jbpm.graph.node.Decision.decisionConditions#12789], CollectionKey[org.jbpm.taskmgmt.exe.TaskMgmtInstance.swimlaneInstances#110], CollectionKey[org.jbpm.taskmgmt.exe.TaskMgmtInstance.swimlaneInstances#112], CollectionKey[org.jbpm.taskmgmt.exe.TaskMgmtInstance.taskInstances#112], CollectionKey[org.jbpm.context.exe.TokenVariableMap.variableInstances#56], CollectionKey[org.jbpm.graph.def.Node.exceptionHandlers#12759], CollectionKey[org.jbpm.graph.def.Node.exceptionHandlers#12760], CollectionKey[org.jbpm.context.exe.TokenVariableMap.variableInstances#55], CollectionKey[org.jbpm.graph.def.Node.exceptionHandlers#12762], CollectionKey[org.jbpm.graph.def.Node.exceptionHandlers#12758], CollectionKey[org.jbpm.graph.def.Node.events#12787], CollectionKey[org.jbpm.graph.def.ProcessDefinition.actions#996], CollectionKey[org.jbpm.graph.def.ProcessDefinition.actions#997], CollectionKey[org.jbpm.graph.def.Node.events#12789], CollectionKey[org.jbpm.graph.def.Transition.exceptionHandlers#16569], CollectionKey[org.jbpm.graph.def.Node.exceptionHandlers#12781], CollectionKey[org.jbpm.graph.def.Transition.exceptionHandlers#16570], CollectionKey[org.jbpm.graph.def.Transition.exceptionHandlers#16571], CollectionKey[org.jbpm.graph.def.Transition.exceptionHandlers#16572], CollectionKey[org.jbpm.graph.def.Node.events#12781], CollectionKey[org.jbpm.taskmgmt.exe.TaskInstance.comments#56], CollectionKey[org.jbpm.graph.exe.ProcessInstance.runtimeActions#55], CollectionKey[org.jbpm.graph.exe.ProcessInstance.runtimeActions#56], CollectionKey[org.jbpm.taskmgmt.exe.TaskInstance.variableInstances#56], CollectionKey[org.jbpm.graph.def.Node.leavingTransitions#12762], CollectionKey[org.jbpm.graph.def.ProcessDefinition.definitions#997], CollectionKey[org.jbpm.graph.exe.ProcessInstance.instances#55], CollectionKey[org.jbpm.graph.def.ProcessDefinition.definitions#996], CollectionKey[org.jbpm.graph.exe.ProcessInstance.instances#56], CollectionKey[org.jbpm.graph.def.Node.leavingTransitions#12758], CollectionKey[org.jbpm.graph.def.Node.events#12762], CollectionKey[org.jbpm.graph.def.Node.leavingTransitions#12760], CollectionKey[org.jbpm.graph.def.Node.leavingTransitions#12759], CollectionKey[org.jbpm.graph.def.Node.exceptionHandlers#12789], CollectionKey[org.jbpm.graph.def.Node.events#12758], CollectionKey[org.jbpm.graph.def.Node.events#12759], CollectionKey[org.jbpm.graph.def.Node.exceptionHandlers#12787], CollectionKey[org.jbpm.graph.def.Node.events#12760]]];ActionQueue[insertions=[] updates=[] deletions=[EntityDeleteAction[org.jbpm.job.Timer#26]] collectionCreations=[] collectionRemovals=[] collectionUpdates=[]])
  | 2008-02-11 11:05:02,427 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.job.Timer#26]
  | 	at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1761)
  | 	at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2519)
  | 	at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2693)
  | 	at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74)
  | 	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:144)
  | 	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.jbpm.persistence.db.DbPersistenceService.flushSession(DbPersistenceService.java:272)
  | 	at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:232)
  | 	at org.jbpm.svc.Services.close(Services.java:224)
  | 	at org.jbpm.JbpmContext.close(JbpmContext.java:139)
  | 	at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:193)
  | 	at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:64)
  | 2008-02-11 11:05:02,443 ERROR [org.jbpm.persistence.db.DbPersistenceService] hibernate flush failed
  | org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.job.Timer#26]
  | 	at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1761)
  | 	at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2519)
  | 	at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2693)
  | 	at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74)
  | 	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:144)
  | 	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.jbpm.persistence.db.DbPersistenceService.flushSession(DbPersistenceService.java:272)
  | 	at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:232)
  | 	at org.jbpm.svc.Services.close(Services.java:224)
  | 	at org.jbpm.JbpmContext.close(JbpmContext.java:139)
  | 	at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:193)
  | 	at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:64)
  | 2008-02-11 11:05:02,458 DEBUG [org.jbpm.persistence.db.DbPersistenceService] rolling back hibernate transaction
  | 2008-02-11 11:05:02,458 ERROR [org.jbpm.persistence.db.DbPersistenceService] hibernate rollback failed
  | java.lang.NullPointerException
  | 	at org.jbpm.persistence.db.DbPersistenceService.rollback(DbPersistenceService.java:304)
  | 	at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:234)
  | 	at org.jbpm.svc.Services.close(Services.java:224)
  | 	at org.jbpm.JbpmContext.close(JbpmContext.java:139)
  | 	at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:193)
  | 	at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:64)
  | 

Any ideas on how to avoid/ solve this problem? Any suggestions or comments would be gratefully received.

Many thanks, Peter.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128325#4128325

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128325




More information about the jboss-user mailing list