[jboss-user] [JBoss jBPM] - Re: Stale state problem kills process instance?

justin.zhou do-not-reply at jboss.com
Tue Jul 31 00:54:50 EDT 2007


I have the similar problem with hibernate323, jbpm321, jboss420.


anonymous wrote : 2007-07-30 23:14:20,714 5742606 ERROR [com.rrd.pmt.workflow.service.Task] (pool-6-thread-1:) 
  | org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.graph.exe.Token#11804]
  |         at org.hibernate.persister.entity.AbstractEntityPersister.forceVersionIncrement(AbstractEntityPersister.java:1235)
  |         at org.hibernate.event.def.AbstractLockUpgradeEventListener.upgradeLock(AbstractLockUpgradeEventListener.java:82)
  |         at org.hibernate.event.def.DefaultLockEventListener.onLock(DefaultLockEventListener.java:64)
  |         at org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:584)
  |         at org.hibernate.impl.SessionImpl.lock(SessionImpl.java:576)
  |         at org.jbpm.graph.node.Join.execute(Join.java:109)
  |         at org.jbpm.graph.def.Node.enter(Node.java:318)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
  |         at org.jbpm.graph.def.Node_$$_javassist_544.enter(Node_$$_javassist_544.java)
  |         at org.jbpm.graph.def.Transition.take(Transition.java:151)
  |         at org.jbpm.graph.def.Node.leave(Node.java:393)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
  |         at org.jbpm.graph.def.Node_$$_javassist_544.leave(Node_$$_javassist_544.java)
  |         at org.jbpm.graph.exe.Token.signal(Token.java:194)
  |         at org.jbpm.graph.exe.Token.signal(Token.java:139)
  |         at com.rrd.pmt.workflow.service.AbstractTaskExecutorService.doTranstion(AbstractTaskExecutorService.java:123)
  |         at com.rrd.pmt.workflow.service.Task.run(Task.java:40)
  |         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
  |         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
  |         at java.util.concurrent.FutureTask.run(FutureTask.java:123)
  |         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
  |         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
  |         at java.lang.Thread.run(Thread.java:613)
  | 

The strange thing is if I use ejb timers to execute all the fork steps, everything is fine. However, if driving one of the fork steps with external jbpmconfigure, although still using the same hibernate session factory as other timers steps, it will have this error, my external jbpmconfig code looks like:

caller:
  | 
  | public void doTranstion(long id, String tokenPath, String path) throws Exception {
  | 		JbpmContext jbpmContext = JbpmUtil.getJbpmConfig().createJbpmContext();
  | 		try {
  | 			ProcessInstance processInstance = jbpmContext.loadProcessInstanceForUpdate(id);
  | 			if (processInstance == null) {
  | 				logger.debug("ProcessInstance " + id +  " does not exist anymore. Ignore it");
  | 				return;
  | 			}
  | 			
  | 			Token token = processInstance.findToken(tokenPath);
  | 			logger.info("ProcessIntance " + processInstance.getId() + " changing from node[" + token.getNode().getDefaultLeavingTransition().getFrom().getName() + "] to node[" 
  | 				            + token.getNode().getDefaultLeavingTransition().getTo().getName() + "]" + ". File=" + path);
  | 			token.signal();
  | 		} catch (Exception e) {
  | 			logger.error("", e);
  | 			throw e;
  | 		} finally {
  |     		jbpmContext.close();
  |     	}
  | 	}
  | 
  | 
  | 
  | public class JbpmUtil {
  | 	static Logger logger = Logger.getLogger(JbpmUtil.class);
  | 	static private JbpmConfiguration jbpmConfiguration = null;
  | 	
  | 	synchronized static public JbpmConfiguration getJbpmConfig() {
  | 		if (jbpmConfiguration == null) {
  | 			jbpmConfiguration = JbpmConfiguration.getInstance("jbpm.cfg.xml");
  | 		}
  | 		
  | 		return jbpmConfiguration;
  | 	}
  | ...}


Using treecache with serializable isolation. Token used in the code is retrieved from 
ExecutionContext.getToken().getFullName();

Still wondering what is difference here? Should treecache take care this?

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

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



More information about the jboss-user mailing list