Search code examples
javawebsphere-libertyopen-liberty

How can I solve reading MQ messages resulting in error on commit/rollback?


While working on getting an MQ connection to work in Liberty, I'm encountering the following problem.

After a message is received, the following error occurs: JMSCC0014: It is not valid to call the 'commit' method on a nontransacted session.

I've done some searching and found something about needing to use an XA version of the connection factory, but I don't know if that is indeed the solution and I haven't found any clear example of how to achieve that in the configuration I have.

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/incomingRequestQueue" jndiName="jms/incomingRequestQueue">
    <properties.mqJms baseQueueName="QUEUEIN"/>
</jmsQueue>

The queueConnectionFactory is retrieved through JNDI in the code.

Any help would be greatly appreciated.


Solution

  • The solution was eventually to not do a commit / rollback after receiving an MQ message, see here for more information: Websphere Liberty : JMS Sessions don't work.