WebService Call with SOAP over JMS produces : java.lang.RuntimeException: MQJCA1018: Only one session per connection is allowed. in JBoss EAP 7

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 7
  • SOAP over JMS
  • IBM MQ

Issue

We use a JAX-WS Client to call a SOAP Webservice over JMS by using the Messaging Provider IBM WebSphere MQ. The WebService Provider of JBoss EAP (Apache CXF) produces an exception:

WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (default task-3) Interceptor for {http://schema.example.redhat.com/ws/Example}ExampleWS#{http://schema.example.redhat.com/ws/Example}ExampleWS has thrown exception, unwinding now: java.lang.RuntimeException: MQJCA1018: Only one session per connection is allowed.
        at org.apache.cxf.transport.jms.util.JMSUtil.convertJmsException(JMSUtil.java:65)
        at org.apache.cxf.transport.jms.util.MessageListenerContainer.start(MessageListenerContainer.java:66)
        at org.apache.cxf.transport.jms.JMSConduit.setupReplyDestination(JMSConduit.java:183)
        at org.apache.cxf.transport.jms.JMSConduit.sendAndReceiveMessage(JMSConduit.java:195)
        at org.apache.cxf.transport.jms.JMSConduit.sendExchange(JMSConduit.java:145)
        at org.apache.cxf.transport.jms.MessageStreamUtil$SendingOutputStream.doClose(MessageStreamUtil.java:81)
        at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:212)
        at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
        at org.apache.cxf.transport.jms.JMSConduit.close(JMSConduit.java:101)
        at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
        at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277)
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
        at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)

Resolution

CXF added a property oneSessionPerConnection (which is available in EAP 7.2+) , this should be set to true when using the IBM WebSphere MQ messaging broker, for example:

<soap:address location="jms:jndi:jms/mq/requestQueue?jndiInitialContextFactory=org.jboss.as.naming.InitialContextFactory&jndiConnectionFactoryName=jms/mq/esbconsumerWebServicesQCF&replyToName=jms/mq/responseQueue&jndiURL=http-remoting://127.0.0.1:8080&oneSessionPerConnection=true"/>

A possible workaround prior to Content from issues.apache.org is not included.CXF-7023 which was fixed in CXF 3.2.2.

Set useConduitIdSelector to false such as:

<soap:address location="jms:jndi:jms/mq/requestQueue?jndiInitialContextFactory=org.jboss.as.naming.InitialContextFactory&jndiConnectionFactoryName=jms/mq/ExampleWSQueue&jndiURL=http-remoting://127.0.0.1:8080&useConduitIdSelector=false"></soap:address>

Related Solutions

Root Cause

useConduitIdSelector:

Default:true

This parameter specifies whether the conduit's UUID will be used as the prefix for all correlation IDs.As all conduits are assigned a unique UUID, setting this property to true enables multiple endpoints to share a JMS queue or topic.
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.