Using WebSphere MQ with the Liberty profile

Today’s GA of WebSphere Application Server introduces support for WebSphere MQ using the Java Message Service (JMS) APIs. This support is enabled using the new feature:

<featureManager>
  <feature>wmqJmsClient-1.1</feature>
</featureManager>

The Liberty profile does not include a copy of the WebSphere MQ client. We decided to make the experience of using WebSphere MQ consistent with other resource providers such as databases where the provider specific classes come from the resource provider.

To simplify the deployment of the client libraries we decided to use the WebSphere MQ rar package so there is only a single file that needs to be handled. Normally you can get this from your WebSphere MQ client or server install, but you need a client or server install with APAR IC92914 which is targetted for the 7.5.0.2 release. In the meantime you can download the iFix from Fix Central. There is a technote describing all the details.

Once you have the resource adapter you just need to define a single variable in server.xml to tell the wmqJmsClient-1.1 where the client is

<variable name="wmqJmsClient.rar.location"        
          value="${shared.resource.dir}/wmq/wmq.jmsra.rar"/>

You can then configure your JMS resources.

<jmsConnectionFactory jndiName="jms/qcf1">
  <properties.wmqJms queueManager="qm1"/>
</jmsConnectionFactory>
    
<jmsQueue id="myQueue" jndiName="jms/queue1">
  <properties.wmqJms baseQueueName="MDBQ" />
</jmsQueue>

<jmsActivationSpec id="fvtapp/fvtmdb/FVTMessageDrivenBean">
  <properties.wmqJms destinationRef="myQueue" 
                     destinationType="javax.jms.Queue" 
                     queueManager="qm1"/>
</jmsActivationSpec>
  • Chris Watts

    I’ve installed the iFix, set it all up and configured a

    However I get the following error:
    ——Start of DE processing—— = [2/07/13 12:54:14:239 EST]
    Exception = javax.naming.NamingException
    Source = com.ibm.ws.jndi.internal.WSContext
    probeid = 139
    Stack Dump = javax.naming.NamingException: ConnectionFactoryImpl reference is null
    at com.ibm.mq.connector.outbound.ConnectionFactoryImpl.getReference(ConnectionFactoryImpl.java:305)
    at org.apache.aries.jndi.ObjectFactoryHelper.getObjectInstance(ObjectFactoryHelper.java:64)
    at org.apache.aries.jndi.OSGiObjectFactoryBuilder.getObjectInstance(OSGiObjectFactoryBuilder.java:57)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:283)
    at com.ibm.ws.jndi.internal.WSContext.resolveObject(WSContext.java:128)
    at com.ibm.ws.jndi.internal.WSContext.lookup(WSContext.java:296)
    at com.ibm.ws.jndi.internal.WSContext.lookup(WSContext.java:291)
    at org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)

    • Chris Watts

      Copy paste error, should have been:

    • Chris Watts

      After trying everything I could think of, I found out what was missing.

      I didn’t have this in my web.xml:

      jms/qcf
      javax.jms.QueueConnectionFactory
      Container

  • jack