2

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.

Anthon
  • 95
  • 7

1 Answers1

2

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.

lwestby
  • 1,209
  • 6
  • 10
  • 1
    Most of the time it is better to leave `baseQueueManagerName` empty, mq by default will resolve a locally defined queue on the `queueManager`. – JoshMc May 08 '20 at 15:42
  • Is `queueManager` always required or are there situations where it can be left off? – lwestby May 08 '20 at 16:21
  • 1
    queueManager can be left `NULL` or all spaces or `*`, this is a special case that tells MQ to ignore the queue manager name of the queue manager you connect to and accept any. If you specify a value other than those the QM name you connect to must match what you specify or you receive a queue manager name error. If you were using a CCDT then there is another case where you specify a QMName proceeded by a `*`, MQ will look up the entrie(s) in the CCDT that match the name with out the `*` and connect to one of them and will NOT try to match the name, this is called a QMGroup. – JoshMc May 08 '20 at 16:48
  • The baseQueueName was the problem, thanks very much. Now I have a rollback error which I have to figure out, but it's a step in the right direction. – Anthon May 08 '20 at 17:34
  • 1
    You'll probably want to open another question on that one if you can't figure it out. I think if this one is finished you can mark it accepted so people know it doesn't need attention. – lwestby May 08 '20 at 17:55