-
1. Re: Anyone notice any JBPM problems with not releasing connection pools?
jnusaira Apr 29, 2008 9:58 PM (in response to jnusaira)FWIW ... i recreated the problem with a smaller project.
Basically our architecture has messages going to a queue.
The MDB picks them up and sends them to a jBPM for processing.
So something like this
MDB
public void onMessage(Message message) { try { // run if (message instanceof ObjectMessage) { String name = ((ObjectMessage) message).toString(); todoFlow.createTodo("josepH"); } } catch (Throwable t) { System.out.println("Error - " +t.getMessage()); }
jBPM bean
@Stateful @Name("todoFlow") public class TodoFlowImpl implements TodoFlow { @PersistenceContext EntityManager em; @CreateProcess(definition="GenericTodoFlow") public void createTodo(String name) { Todo todo = new Todo(); todo.setName(name); todo.setCreateDate(new Date()); em.persist(todo); } public void updateDate() { // update the date System.out.println("modify date"); } @Remove @Destroy public void destroy() { } }
the flow
<process-definition name="GenericTodoFlow"> <start-state name="start"> <transition to="working"/> </start-state> <node name="working"> <transition name="working example" to="End Flow"> <action expression="#{todoFlow.updateDate}" ></action> </transition> </node> <end-state name="End Flow"></end-state> </process-definition>
components.xml (partial)
<persistence:managed-persistence-context name="entityManager" auto-create="true" persistence-unit-jndi-name="java:/EMFactory"/> <transaction:ejb-transaction/> <!-- For use with jBPM pageflow or process management --> <bpm:jbpm> <bpm:process-definitions> <value>flow-jpdl.xml</value> </bpm:process-definitions> </bpm:jbpm> <jms:managed-queue-sender name="todoQueueSender" auto-create="true" queue-jndi-name="queue/TodoFlowQueue"/> <jms:queue-connection queue-connection-factory-jndi-name="ConnectionFactory"/>
So we run that, and we added the ejb-transaction attribute because if you don't it won't work and it will tell you hey why dont you add this in.
however when we do all this we get
WARN [com.arjuna.ats.arjuna.logging.arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_4] TwoPhaseCoordinator.afterCompletion - returned failure for com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple@a3e71c
in the console, we are on Jboss 4.2.1
And basically the big issue is the db connections are not getting
let go
. We do not have this problem when using seam 1.2, just the 2.0.1.Any ideas? at all? Thanks
-
2. Re: Anyone notice any JBPM problems with not releasing connection pools?
jnusaira Apr 30, 2008 6:59 PM (in response to jnusaira)FWIW - if anyone else has this problem.
The way i
fixed
it .... and by fix i am not sure why i had to do this in the first place but i understand why it would work.I had to make the MDB bean managed transaction. that way their was no transaction syncing issues.
Eh, if this is a bug and any of you seam guys want a zip of my sample code just shoot me an email at jnusairat@integrallis.com
-
3. Re: Anyone notice any JBPM problems with not releasing connection pools?
dahm Jun 10, 2008 2:48 PM (in response to jnusaira)We had similar problems in the context of complex interaction with JMS messages, JBPM and data base transactions. We noticed that in some
cases the message receiving transaction reported the describeed warning and another transaction read stale old data from the database.
However, this did not happen always.It seems to be related to http://jira.jboss.com/jira/browse/EJBTHREE-898
However, your workaround resolved the warning. We rewrote the message driven bean to use bean managed transactions and the warning message disappeared.
-
4. Re: Anyone notice any JBPM problems with not releasing connection pools?
tnfink Jun 20, 2008 10:29 AM (in response to jnusaira)The change to using a BMT-MDB instead of CMT-MDB fixed our problems in the application. Unfortunately the embedded tests do not function anymore. There seems to be a problem to inject the SessionContext into the MDB.
These are some fragments of our MDB-Code:
@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "5"), @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "AUTO_ACKNOWLEDGE"), @ActivationConfigProperty(propertyName = "DLQMaxResent", propertyValue = "10"), @ActivationConfigProperty(propertyName = "destination", propertyValue = PaymentRequestService.MPS_RESPONSE_QUEUE) }) @Name("responseReceiver") @TransactionManagement(TransactionManagementType.BEAN) public class AcquirerResponseReceiverMDB implements MessageListener { @Resource private SessionContext sessionContext; public final void onMessage(final Message message) { final UserTransaction transaction = sessionContext.getUserTransaction(); transaction.begin(); try { ... transaction.commit(); } catch (final Exception exc) { try { transaction.rollback(); } catch (final Exception e) { log.warn("Cannot rollback", e); } } } }
This is the exception we get:
ERROR [org.jboss.injection.lang.reflect.FieldBeanProperty] failed to set value org.jboss.ejb3.mdb.MessageDrivenContextImpl@65f97d on field private javax.ejb.SessionContext com.cellactive.mp.server.payment.AcquirerResponseReceiverMDB.sessionContext java.lang.IllegalArgumentException at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63) at java.lang.reflect.Field.set(Field.java:656) at org.jboss.injection.lang.reflect.FieldBeanProperty.set(FieldBeanProperty.java:74) at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:91) at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:84) at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:56) at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:100) at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:73) at org.jboss.ejb3.pool.StrictMaxPool.get(StrictMaxPool.java:144) at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:55) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:76) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:246) at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:267) at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:137) at $Proxy192.onMessage(Unknown Source) at org.jboss.resource.adapter.jms.inflow.JmsServerSession.onMessage(JmsServerSession.java:178) at org.jboss.jms.client.container.ClientConsumer.callOnMessage(ClientConsumer.java:157) at org.jboss.jms.client.container.SessionAspect.handleRun(SessionAspect.java:802) at org.jboss.aop.advice.org.jboss.jms.client.container.SessionAspect_z_handleRun_10719543.invoke(SessionAspect_z_handleRun_10719543.java) at org.jboss.jms.client.delegate.ClientSessionDelegate$run_N8003352271541955702.invokeNext(ClientSessionDelegate$run_N8003352271541955702.java) at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170) at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:106) at org.jboss.jms.client.delegate.ClientSessionDelegate$run_N8003352271541955702.invokeNext(ClientSessionDelegate$run_N8003352271541955702.java) at org.jboss.jms.client.delegate.ClientSessionDelegate.run(ClientSessionDelegate.java) at org.jboss.jms.client.JBossSession.run(JBossSession.java:199) at org.jboss.resource.adapter.jms.inflow.JmsServerSession.run(JmsServerSession.java:234) at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204) at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260) 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)
Anyone any ideas?
-
5. Re: Anyone notice any JBPM problems with not releasing connection pools?
beligum.b.beligum.org Oct 1, 2008 3:04 PM (in response to jnusaira)For what's it worth:
try this:
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void onMessage(Message msg)
{
...
}
Instead of starting the session manually.