Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-7975

jms.util.MessageListenerContainer is incompatible with JEE web and EJB applications

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.2.7
    • None
    • JMS
    • None
    • WebSphere Application Server 8.5.5.11

      OpenJDK 1.8.0_181

    • Unknown

    Description

      Invoking a for JMS configured JAX WS client with a ConnectionFactory managed by an application server results in the following stacktrace:

      org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging Interceptor for [...] has thrown exception, unwinding now
                                       java.lang.RuntimeException: Method setMessageListener not permitted
              at org.apache.cxf.transport.jms.util.JMSUtil.convertJmsException(JMSUtil.java:92)
              at org.apache.cxf.transport.jms.util.MessageListenerContainer.start(MessageListenerContainer.java:66)
              at org.apache.cxf.transport.jms.JMSConduit.setupReplyDestination(JMSConduit.java:236)
              at org.apache.cxf.transport.jms.JMSConduit.sendAndReceiveMessage(JMSConduit.java:248)
              at org.apache.cxf.transport.jms.JMSConduit.sendExchange(JMSConduit.java:177)
              at org.apache.cxf.transport.jms.MessageStreamUtil$SendingWriter.close(MessageStreamUtil.java:66)
              at org.apache.cxf.transport.jms.MessageStreamUtil.closeStreams(MessageStreamUtil.java:89)
              at org.apache.cxf.transport.jms.JMSConduit.close(JMSConduit.java:103)
              at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63)
              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
              at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)
              at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:440)
              at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:355)
              at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313)
              at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
              at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:140)
      [...]
      

      The exception is thrown by WebSphere's impl of javax.jms.MessageConsumer (com.ibm.ejs.jms.JMSMessageConsumerHandle) that wraps the MessageConsumer impl of our JMS provider:

      Caused by: javax.jms.IllegalStateException: Method setMessageListener not permitted
              at com.ibm.ejs.jms.JMSCMUtils.methodNotPermittedException(JMSCMUtils.java:244)
              at com.ibm.ejs.jms.JMSMessageConsumerHandle.setMessageListener(JMSMessageConsumerHandle.java:397)
              at org.apache.cxf.transport.jms.util.MessageListenerContainer.start(MessageListenerContainer.java:62)
              ... 100 more
      

      According to the JMS 2.0 docs on MessageConsumer.setMessageListener this kind of behavior can be expected (though from what i can find only WebSphere chose this route):

      [...]
      
      This method must not be used in a Java EE web or EJB application. Doing so may cause a JMSException to be thrown though this is not guaranteed.
      

      Source: https://docs.oracle.com/javaee/7/api/javax/jms/MessageConsumer.html#setMessageListener-javax.jms.MessageListener-

      Line where setMessageListener is called: MessageListenerContainer:62 (after creation of the container on JMSConduit:224).

       

      Is there currently any way to work around this (besides not using a managed connection factory)?

      Attachments

        Activity

          People

            Unassigned Unassigned
            M. Schuurman Milko Schuurman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: