[jboss-dev-forums] [Design of JCA on JBoss] - Problems JCA JMS inflow issue and tx NotSupported

timfox do-not-reply at jboss.com
Sat Jan 13 06:10:42 EST 2007


Weston - sorry to bug you again.

I'm using the JCA inflow invoker-proxy-binding in JBoss-4.0.5.GA for MDBs, and I'm using JBoss Messaging as the JMS provider.

I have the following trivial MDB:


  | public class MDBExample implements MessageDrivenBean, MessageListener
  | {
  |    public void onMessage(Message m)
  |    {	 
  |           System.out.println("got message " + m);      
  |    }
  | 
  |     public void ejbCreate()
  |     {
  |     }
  | 
  |     public void ejbRemove()
  |     {
  |     }
  | }
  | 
  | <ejb-jar>
  |     <enterprise-beans>
  |         <message-driven>
  |             <ejb-name>MDBExample</ejb-name>
  |             <ejb-class>org.jboss.example.jms.mdb.MDBExample</ejb-class>
  |             <transaction-type>Container</transaction-type>
  |             <message-driven-destination>
  |                <destination-type>javax.jms.Queue</destination-type>
  |             </message-driven-destination>
  |         </message-driven>
  |     </enterprise-beans>
  | 
  |  <assembly-descriptor>
  |         <container-transaction>
  |             <method>
  |                 <ejb-name>MDBExample</ejb-name>
  |                 <method-name>*</method-name>
  |             </method>
  |             <trans-attribute>Required</trans-attribute>
  |         </container-transaction>
  |     </assembly-descriptor>
  | </ejb-jar>
  | 

I sent a message, and it all works fine, the message gets consumed and acked.

I then change the trans-attribute to "NotSupported", so the onMessage should not be run in a tx context, and send a message again, and I get:


  | 10:59:37,437 ERROR [JmsServerSession] Failed to commit session transaction
  | javax.jms.TransactionInProgressException: Cannot call commit on an XA session
  |         at org.jboss.jms.client.container.TransactionAspect.handleCommit(TransactionAspect.java:97)
  |         at org.jboss.aop.advice.org.jboss.jms.client.container.TransactionAspect14.invoke(TransactionAspect14.java)
  |         at org.jboss.jms.client.delegate.ClientSessionDelegate$commit_8461082169793485964.invokeNext(ClientSessionDelegate$commit_8461082169793485964.
  | java)
  |         at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:182)
  |         at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:117)
  |         at org.jboss.jms.client.delegate.ClientSessionDelegate$commit_8461082169793485964.invokeNext(ClientSessionDelegate$commit_8461082169793485964.
  | java)
  |         at org.jboss.jms.client.container.ExceptionInterceptor.invoke(ExceptionInterceptor.java:69)
  |         at org.jboss.jms.client.delegate.ClientSessionDelegate$commit_8461082169793485964.invokeNext(ClientSessionDelegate$commit_8461082169793485964.
  | java)
  |         at org.jboss.jms.client.container.ClientLogInterceptor.invoke(ClientLogInterceptor.java:107)
  |         at org.jboss.jms.client.delegate.ClientSessionDelegate$commit_8461082169793485964.invokeNext(ClientSessionDelegate$commit_8461082169793485964.
  | java)
  |         at org.jboss.jms.client.delegate.ClientSessionDelegate.commit(ClientSessionDelegate.java)
  |         at org.jboss.jms.client.JBossSession.commit(JBossSession.java:165)
  |         at org.jboss.resource.adapter.jms.inflow.JmsServerSession$LocalDemarcationStrategy.end(JmsServerSession.java:341)
  |         at org.jboss.resource.adapter.jms.inflow.JmsServerSession.run(JmsServerSession.java:260)
  |         at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
  |         at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
  |         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
  |         at java.lang.Thread.run(Thread.java:534)
  | 

I.e. it fails.

A couple of things I don't understand:

Why is there a transaction in the first place? The onMessage is supposed to run without a transaction and should be using the ack mode specified on the ejb (either dups_ok or auto_ack)

Why is JCA attempting to call commit() on it? The session that the JCA layer creates is an XASession and calling commit() on an XASession is illegal.
(see http://java.sun.com/j2ee/1.4/docs/api/index.html)

For a "NotSupported" method, I would expect the session used to do the message consumption to be a standard non XA session obtained from a standard non XA JMS connection, and I wouldn't expect commit to be called on it.



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

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



More information about the jboss-dev-forums mailing list