Hi all,
I'm facing jBPM (workflow engine) for the first time (and I'm not an expert in hibernate) and just when I was about to start coding my application, I faced an issue that I couldn't find any answer for the last two days.
jBPM uses hibernate.
I'm using jBPM-3.1.3 as lib's (jbpm-3.1.3.jar and jbpm-identity-3.1.3.jar) inside my Enterprise Application (.ear) deployed in a SJSAS 8.1 2005Q1.
For the database I'm using Oracle 9i with the Oracle JDBC driver, 9.2.0.8 version. Hibernate 3.2.1 connects through a datasource defined in the SJSAS.
I'm creating a ProcessInstance (hibernate object) inside a jsp (web based application front end) and sending a signal to a jPBM process instance to start up. This will trigger a action configured to send a message to a MDB (Message Driven Bean) through a queue.
The problem is that sometimes (race condition) the MDB starts to process the message before the jsp finishes its work (commiting the transaction and writing the process instance to the database). In the message that the MDB receives comes a processInstanceId that is used to search for that process instance in the database. Every now and then when the MDB starts the process before the jsp commits the transaction it will lead to a:
Code:
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [org.jbpm.graph.exe.
ProcessInstance#644]
at org.hibernate.impl.SessionFactoryImpl$1.handleEntityNotFound(SessionFactoryImpl.java:375)
at org.hibernate.proxy.AbstractLazyInitializer.checkTargetState(AbstractLazyInitializer.java
:79)
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:68)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.jav
a:111)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:140)
at org.jbpm.graph.exe.ProcessInstance$$EnhancerByCGLIB$$f514ef34.signal(<generated>)
at my.package.ResponseMDBean.onMessage(ResponseMDBean.java:88)
at sun.reflect.GeneratedMethodAccessor107.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.j
ava:983)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:147)
at com.sun.ejb.containers.MessageBeanContainer.deliverMessage(MessageBeanContainer.java:956)
at com.sun.ejb.containers.MessageBeanListenerImpl.deliverMessage(MessageBeanListenerImpl.jav
a:42)
at com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpo
intInvocationHandler.java:130)
at $Proxy25.onMessage(Unknown Source)
at com.sun.messaging.jms.ra.OnMessageRunner.run(OnMessageRunner.java:187)
at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:45)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(Unknown Source)
Can anyone help me on this please?
Thanks in advance,
Délio Guerra