Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Does WAS 5 built-in JMS provider support XA?

6 views
Skip to first unread message

Mark M

unread,
Apr 26, 2003, 8:30:19 AM4/26/03
to
It appears that the built-in JMS provider in WAS 5.0 does not support
XA transactions. I can find no definitive documentation either way,
but the capability must be there somewhere in order to support MDBs.
But when creating a TopicConnectionFactory using the WAS console, we
have checked the "XA enabled" box. When our EJB creates a transacted
JMS session and attempts to publish on it, the following exception is
thrown:

[4/25/03 17:13:32:062 EDT] 5b9000c3 ConnectionEve E J2CA0074E: Unable
to enlist connection from resource JMS$FIPER
TCF$JMSManagedConnection@1111244998 with current transaction in method
localTransactionStarted due to exception. Initiating destruction of
connection. Exception is:
javax.resource.spi.ResourceAdapterInternalException: getXAResource
called on non-XA managed sesssion
at com.ibm.ejs.jms.JMSManagedSession.getXAResource(JMSManagedSession.java:376)
at com.ibm.ejs.j2c.ConnectionManager.initializeForUOW(ConnectionManager.java:726)
at com.ibm.ejs.j2c.MCWrapper.getCurrentTranWrapper(MCWrapper.java:810)
at com.ibm.ejs.j2c.ConnectionEventListener.localTransactionStarted(ConnectionEventListener.java:544)
at com.ibm.ejs.jms.JMSManagedSession.localTransactionStarted(JMSManagedSession.java:853)
at com.ibm.ejs.jms.JMSManagedSession.enlist(JMSManagedSession.java:809)
at com.ibm.ejs.jms.JMSMessageProducerHandle.enlist(JMSMessageProducerHandle.java:716)
at com.ibm.ejs.jms.JMSTopicPublisherHandle.publish(JMSTopicPublisherHandle.java:173)
at com.engineous.system.pse.JobMgrBean.runJob(JobMgrBean.java:1351)


The scenario is this: A stateless session bean with bean-managed
transactions and an XA-enabled database does the following:

in the setSessionContext() method --

factory = (TopicConnectionFactory)context.lookup(jndiTCFName);
jobTopicConnection = factory.createTopicConnection();
jmsSession = jobTopicConnection.createTopicSession(true,
Session.AUTO_ACKNOWLEDGE); // Transactional session
jobTopic = jmsSession.createTopic(PSECommon.TOPICNAME_JOB);
jobTopicPublisher = jmsSession.createPublisher(jobTopic);


in a business method called by the client --


UserTransaction ut = sessionContext.getUserTransaction();
ut.begin();
...
... create/modify some entity EJBs
...
TextMessage msg = jmsSession.createTextMessage();
...
... populate the message
...
jobTopicPublisher.publish(msg); <<<--- Exception occurs here
...
...
ut.commit(); // Complete transaction for EJBs and JMS

It seems that there should be a way to create an
XATopicConnectionFactory in the WAS console, but there is not. The
"XA enabled" checkbox does not seem to do anything; we get the same
results with or without this option set.

Our application depends a lot on the above code pattern. Using
non-transacted JMS sessions would require a great deal of code rewrite
and loss of integrity (since the EJB and JMS transactions would no
longer be coordinated).

Mark M

unread,
May 16, 2003, 1:18:39 PM5/16/03
to
I'll answer my own question: The problem is the coding pattern we used
in our EJBs. We obtained the transacted JMS session during
setSessionContext(), and then publish on it inside a business method.

In order for JMS to participate in the global (XA) transaction, the
JMS session must be created within the scope of the transaction.
There is no transaction scope during setSessionContext(). So moving
our JMS session create into the business method (where there is an
active transaction scope) solved this problem. The only side effect
is lots more create/destroy of JMS sessions, but it works.

0 new messages