Hi,

I am using the jbpm console for orchestrate my process definition. However, 
some of the process nodes request asynchronous tasks to external systems. When 
those tasks  finish, the workflow engine receives an incoming message through 
JMS (openMQ). What I'm currently doing in response to that message is just to 
signal the root token to the next node:


  | try {
  |             
  |             MapMessage mapMessage = (MapMessage)message;
  |             JbpmConfiguration conf = JbpmConfiguration.getInstance(); 
  |             JbpmContext ctx = conf.createJbpmContext();
  |             try {           
  |                     
  |                     ProcessInstance processInstance = 
ctx.loadProcessInstanceForUpdate(Long.parseLong(mapMessage.getString("processInstance")));
                    
  |                     processInstance.getRootToken().signal();                
  |                     
  |             }finally {
  |                     ctx.close();
  |             }
  | 
  | 

It works but I'm getting this obvious exception:


  | ERROR - AbstractFlushingEventListener.performExecutions(301) | 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#64]
  |         at 
org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1769)
  |         at 
org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2412)
  |         at 
org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2312)
  |         at 
org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2612)
  |         at 
org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:96)
  |         at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
  |         at 
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
  |         at 
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)
  |         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:256)
  |         at 
org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:214)
  |         at org.jbpm.svc.Services.close(Services.java:225)
  |         at org.jbpm.JbpmContext.close(JbpmContext.java:139)
  |         at 
com.marketsentinel.workflow.messaging.MessageListener.onMessage(MessageListener.java:42)
  |         at 
com.sun.messaging.jmq.jmsclient.MessageConsumerImpl.deliverAndAcknowledge(MessageConsumerImpl.java:338)
  |         at 
com.sun.messaging.jmq.jmsclient.MessageConsumerImpl.onMessageToListenerFromReceiveQueue(MessageConsumerImpl.java:316)
  |         at 
com.sun.messaging.jmq.jmsclient.SessionReader.onMessageToLateListeners(SessionReader.java:171)
  |         at 
com.sun.messaging.jmq.jmsclient.SessionReader.deliver(SessionReader.java:149)
  |         at 
com.sun.messaging.jmq.jmsclient.ConsumerReader.run(ConsumerReader.java:189)
  |         at java.lang.Thread.run(Thread.java
  | 

Since I'm creating a new different hibernate session/Jbpm context from the 
message listener. I wonder how could I get the JbpmContext used by the console 
in order to use the same session to update the token status.

I've been searching the jbpm4jsf source code and all the action classes use a 
static "context" . Where does that object is instanciated?

Thanks.


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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4160533
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to