0 Replies Latest reply on May 30, 2012 12:54 PM by srikant vege

    Getting org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.persistence.processinstance.ProcessInstanceInfo#86] Exception

    srikant vege Newbie

      Hi,

       

      I am using JBPM 5.2 with MySql & Tomcat 6 in windows 7.

       

      I have created 3 tomcat instances (T1, T2 & T3)

      T1: deployed gunor & jbpm console in this tomcat

      T2: deployed human task service war (I converted task service 5.2 module into a war file)

      T3. My web application which will handles process & human tasks related requests.

       

      I have created a simple workflow with 2 human task nodes.

       

      I am getting the below mentioned exception while executing these steps.

       

      1. Start the process (it will create a task record in Task table for my first human task)

      2. Read the processInstance by using knowledgeSession.getProcess(id)

      3. Complete the first human task. (here I am getting the actual exception)

      4. After I get the exception, the process continued and there are 2 task records created in Task table for the second human task.

       

      If I skip the 2nd step and execute the steps 1,3 & 4, I am not getting this exception and it is working fine.

       

      Observations:

      When we read the processInstance by using knowledgeSession.getProcess(id) method, internally it is updating the processInstanceInfo table by increasing OPTLOCK value. After this if we complete the task, we are getting the below exception.

       

      Please help me out on solving this issue.

       

      30-May-2012 17:24:42 org.drools.persistence.SingleSessionCommandService rollbackTransaction

      SEVERE: Could not commit session

      java.lang.RuntimeException: Unable to commit transaction

          at org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:182)

          at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:348)

          at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150)

          at org.jbpm.process.workitem.wsht.CommandBasedWSHumanTaskHandler$GetResultContentResponseHandler.execute(CommandBasedWSHumanTaskHandler.java:294)

          at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:153)

          at org.jbpm.task.service.mina.MinaTaskClientHandler.messageReceived(MinaTaskClientHandler.java:47)

          at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:713)

          at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

          at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

          at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)

          at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:375)

          at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:229)

          at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

          at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

          at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)

          at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)

          at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

          at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)

          at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:638)

          at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:598)

          at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:587)

          at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:61)

          at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:969)

          at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

          at java.lang.Thread.run(Thread.java:662)

      Caused by: javax.persistence.OptimisticLockException: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.persistence.processinstance.ProcessInstanceInfo#86]

          at org.hibernate.ejb.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:1244)

          at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1167)

          at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1148)

          at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1154)

          at org.hibernate.ejb.AbstractEntityManagerImpl$3.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1068)

          at org.hibernate.transaction.synchronization.CallbackCoordinator.beforeCompletion(CallbackCoordinator.java:122)

          at org.hibernate.transaction.synchronization.HibernateSynchronizationImpl.beforeCompletion(HibernateSynchronizationImpl.java:51)

          at bitronix.tm.BitronixTransaction.fireBeforeCompletionEvent(BitronixTransaction.java:478)

          at bitronix.tm.BitronixTransaction.commit(BitronixTransaction.java:193)

          at bitronix.tm.BitronixTransactionManager.commit(BitronixTransactionManager.java:120)

          at org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:179)

          ... 26 more

      Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.persistence.processinstance.ProcessInstanceInfo#86]

          at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1950)

          at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2594)

          at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2494)

          at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2821)

          at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:113)

          at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)

          at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)

          at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:185)

          at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)

          at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)

          at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)

          at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383)

          at org.hibernate.transaction.synchronization.CallbackCoordinator.beforeCompletion(CallbackCoordinator.java:117)

          ... 31 more