You can use Atomikos and IBM MQ for JMS/XA messaging. To do so, please follow the configuration instructions outlined below.

NOTE: these instructions have been tested with IBM MQ version for all components (queue manager, extended client, and JMS jars).

Install the IBM "Extended Transactional Client"

If MQ is to participate in JTA/XA transactions then you need the "Extended Transactional Client" module from IBM. This is an additional set of JMS libraries licensed separately from MQ. Contact your IBM representative if you don't have this module.

Add the IBM jars to your classpath

You need to add the following jars to your classpath:


The first jar file is included in the extended client installation, not in the default MQ installation. Don't forget any, or it will not work!

Create the server-side JMS objects

You need at least the following on the server:

  • A queue manager
  • An XA queue connection factory, bound in JNDI
  • A queue (or topic), bound in JNDI

Ask your server administrator to create these for you.

Atomikos/Spring configuration

To configure Atomikos with Spring and MQ, you need to do the following:

  • Look up the XA connection factory in JNDI (Spring can do this)
  • Look up the queue (topic) in JNDI (Spring can do this)
  • Create the AtomikosConnectionFactoryBean (in Spring)
  • IMPORTANT: make sure that the AtomikosConnectionFactoryBean's uniqueResourceName property includes "MQSeries_XA_RMI"!

Example Spring config

The following shows an example Spring configuration fragment. Keep in mind that the should be set correctly for this to work (see your IBM documentation or ask your administrator).

<bean id="mqXaFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
  <!-- set the JNDI name of the xa connection factory as configured on the server -->
  <property name="jndiName" value="..."/>

<bean id="queue" class="org.springframework.jndi.JndiObjectFactoryBean">
  <!-- set the JNDI name of the queue as configured on the server -->
  <property name="jndiName" value="..."/>

<bean id="atomikosConnectionFactory" class="com.atomikos.jms.AtomikosConnectionFactoryBean"
      init-method="init" destroy-method="close">
  <property name="xaConnectionFactory"><ref bean="mqXaFactory"/></property>
  <!-- IMPORTANT: the resourceName MUST contain MQSeries_XA_RMI -->
  <property name="uniqueResourceName" value="My_MQSeries_XA_RMI"/>

Programmatic configuration of the XA connection factory

You can also choose to configure the XA connection factory programmatically. In that case, you need to create and configure an instance of (for queues) or (for topics).

What about the xa_open string?

The IBM Extended Client documentation refers to the xa_open string that needs to be defined. In Java and with JMS, this is all done by the connectors so you don't need to worry about this.

What about the xa_switch?

The IBM documentation also refers to the xa switch structure. Once again, this is taken care of by the JMS connectors so you don't need to worry. The only thing you need to do is ensure that the resourceName of the connection factory includes the string "MQSeries_XA_RMI" as outlined above.

WebSphere MQ Bug

IMPORTANT: Due to a WebSphere MQ Java Client error (version, the JMS Listener may not close connections to MQ Series and/or may have a memory leak when trying to retrieve a connection. This may even cause your queue manager to crash. Make sure you get the WebSphere MQ Jar Files!

Contact Us

Atomikos Corporate Headquarters
Hoveniersstraat, 39/1, 2800
Mechelen, Belgium

T +3215613055

Subscribe to our newsletter

Never miss an update

Copyright 2020 Atomikos BVBA | Our Privacy Policy
By using this site you agree to our cookies. More info. That's Fine