[jBPM] - 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
by srikant vege
srikant vege [https://community.jboss.org/people/srikanthvege1] created the discussion
"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"
To view the discussion, visit: https://community.jboss.org/message/738841#738841
--------------------------------------------------------------
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
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/738841#738841]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 7 months
[jBPM] - How to get current node instance in a workitem handler?
by Affan Dar
Affan Dar [https://community.jboss.org/people/affandar] created the discussion
"How to get current node instance in a workitem handler?"
To view the discussion, visit: https://community.jboss.org/message/729676#729676
--------------------------------------------------------------
We need to persist per processinstance+nodeinstance data during the execution of a workitem. There are quite a few use cases for this:
1) The workitemhandler needs to store some state that it can use to build some additional guarantees in the face of server restarts/crashes.
E.g., in some FireMissileWorkItemHandler() I want to log the fact that the missile was already fired so that if the server crashed before jbpm hits the next persist point and the same process is restarted, the workitemhandler can lookup the state and see that it had already fired a missile. Of course this will not give us an exactly-once guarantee since the server can crash before it checkpointed but this way we give the workitem developers some more control.
2) A workitem handler generates some intermediate data that should be logged/persisted.
Here is the problem: the index for this data should be {processinstanceid, nodeid} since these are the only two things that will remain the same if the process instance is restarted after a crash. The workitemid that is available in a workitemhandler is regenerated if the workitem was executed again on a process restart. Now, within a workitemhandler I could not find any way to extract the node id of the currently executing node or the current node instance. Note that this is readily available for script tasks via kcontext.getNodeInstance(). I don't know why the same is not available for a workitem handler.
In addition to the persistence scenario, another use case for a node id in workitemhandler is that a workitem handler itself needs to generate a signal to a compensation handler. In this case, I want to say something like this in the workitemhandler code:
ksession.signalEvent("Compensate-" + current_node_id, null);
Again, it requires access to the current node id.
Is this an interesting scenario for the community as well? How did other folks resolve this?
Thanks
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/729676#729676]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 7 months
[Beginner's Corner] - multiple scheduler on jboss 4.2
by liumin hu
liumin hu [https://community.jboss.org/people/liuliu] created the discussion
"multiple scheduler on jboss 4.2"
To view the discussion, visit: https://community.jboss.org/message/738827#738827
--------------------------------------------------------------
hi,
I created 3 schedulers on using org.jboss.varia.scheduler.Scheduler. every scheduler works fine.
my problem is : when I put them together every action is called one after another, if one action takes too long, the others is not called until it finished.
how can I have 3 schedulers works separately?
here is what in my jboss-service.xml
<mbean code="org.jboss.varia.scheduler.Scheduler"
name="sigems-ear-dme:service=Scheduler">
<attribute name="StartAtStartup">false</attribute>
<attribute name="SchedulableClass">synchro.ExSchedulable</attribute>
<attribute name="SchedulableArguments"></attribute>
<attribute name="SchedulableArgumentTypes"></attribute>
<attribute name="InitialStartDate">NOW</attribute>
<attribute name="SchedulePeriod">6000</attribute>
<attribute name="InitialRepetitions">-1</attribute>
</mbean>
<mbean code="org.jboss.varia.scheduler.Scheduler"
name="sigems-ear-dme:service=WelchAllyn">
<attribute name="StartAtStartup">false</attribute>
<attribute name="SchedulableClass">synchro.ExWelchAllyn</attribute>
<attribute name="SchedulableArguments">sigems-ear-dme</attribute>
<attribute name="SchedulableArgumentTypes">java.lang.String</attribute>
<attribute name="InitialStartDate">NOW</attribute>
<attribute name="SchedulePeriod">6000</attribute>
<attribute name="InitialRepetitions">-1</attribute>
</mbean>
<mbean code="org.jboss.varia.scheduler.Scheduler"
name="sigems-ear-dme:service=PasserelleSpec">
<attribute name="StartAtStartup">false</attribute>
<attribute name="SchedulableClass">synchro.ExPasserelleSpec</attribute>
<attribute name="SchedulableArguments">sigems-ear-dme</attribute>
<attribute name="SchedulableArgumentTypes">java.lang.String</attribute>
<attribute name="InitialStartDate">NOW</attribute>
<attribute name="SchedulePeriod">60000</attribute>
<attribute name="InitialRepetitions">-1</attribute>
</mbean>
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/738827#738827]
Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 7 months