We have a service to send messages to an IBM MQ queue.
I'm trying to get this to work in Liberty, but when the service class is in postConstruct I get a NullPointerException looking up the queue by its JNDI name.
Here is the relevant portion of the server.xml configuration:
<resourceAdapter id="mqJms" location="/etc/liberty/wmq/wmq.jmsra.rar"/>
<authData id="mqJms.auth" user="user" password="password"/>
<jmsQueueConnectionFactory jndiName="jms/queueConnectionFactory" connectionManagerRef="ConMgr4" containerAuthDataRef="mqJms.auth">
<properties.mqJms transportType="CLIENT"
hostName="server" port="1234"
channel="CHANNEL"/>
</jmsQueueConnectionFactory>
<connectionManager id="ConMgr4"
connectionTimeout="30s"
maxPoolSize="50" minPoolSize="1"
reapTime="60s" agedTimeout="0"/>
<jmsQueue id="jms/outgoingRequestQueue" jndiName="jms/outgoingRequestQueue">
<properties.mqJms queueName="QUEUEOUT"/>
</jmsQueue>
<jmsActivationSpec id="earname/warname/JMSService" authDataRef="mqJms.auth">
<properties.mqJms destinationRef="jms/outgoingRequestQueue" destinationType="javax.jms.Queue"/>
</jmsActivationSpec>
This is the error I get:
J2CA8500E: An error occurred while attempting to configure a property queueName of configuration element com.ibm.ws.jca.adminObject.supertype[jms/incomingResponseQueue] on the class com.ibm.mq.connector.outbound.MQQueueProxy: java.lang.NullPointerException
at com.ibm.ws.jca.internal.BootstrapContextImpl.configure(BootstrapContextImpl.java:471)
Which makes me think that maybe there is something missing in the server.xml, but I cannot figure out what it is.
According to the MQ resource adapter documentation, the queueName
attribute should actually be baseQueueName
. Additionally, you might need to specify the queueManager
on the connection factory or the baseQueueManagerName
on the jmsQueue
properties if the default qmgr value of an empty string isn't valid for your connection.