[jboss-user] [JBoss jBPM] - jBPM and Message Driven Beans

new4jboss do-not-reply at jboss.com
Tue Jan 30 05:43:53 EST 2007

Hi all,
I'm facing jBPM for the first time and just when i was about to start coding my application i faced an issue that i couldn't find any answer in the last two days.

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, version. Hibernate connects through a datasource defined in the SJSAS.

Here is my scenario:


  | <?xml version="1.0" encoding="UTF-8"?>
  | <process-definition xmlns=""  name="suspension.par">
  |    <start-state name="start">
  |       <transition name="" to="node1"></transition>
  |    </start-state>
  |    <node name="node1">
  |       <action class="my.package.SendRequest"/>
  |       <transition name="" to="state1"></transition>
  |    </node>
  |    <state name="state1">
  |       <transition name="" to="end1"></transition>
  |    </state>
  |    <end-state name="end1"></end-state>
  | </process-definition>

I have a jsp that creates a new ProcessInstance:

  | JbpmContext jbpmContext = JbpmConfiguration.getInstance().getCurrentJbpmContext();
  | //creates a new process instance
  | ProcessInstance processInstance = jbpmContext.newProcessInstance("suspension.par");
  | jbpmContext.save(processInstance);
  | //starts the workflow
  | processInstance.signal();

As this point the workflow instance has received a signal to move forward to "node1" where it calls the my.package.SendRequest. This ActionHandler sends a request to a Message Driven Bean (MDB) through a queue.

Thats where the problem reveals itself, and lets see if I can explain here what is happening.

Since the creation of the process instance was responsibility of the jsp, so lets assume that the signal sent inside this jsp makes the MDB receiving the request before the jsp call to jbpmContext.close().

>From what i understood the database "writing" occurs when  we call  jbpmContext.close(), so nothing was written to the database as for the time of MDB receiving the request.

In the request that the MDB is receiving is the processInstanceId that is used to load the ProcessInstance from the database. But when i try to do that:

  | 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.java: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.java: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.java:42)
  |         at com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.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

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

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

More information about the jboss-user mailing list