0

Getting below exception at runtime during queue connection -

java.lang.ClassCastException: com.ibm.mq.connector.outbound.MQQueueProxy incompatible with com.ibm.mq.jms.MQQueue

Below is the piece of code for reference. I am trying to run application on Websphere Liberty -

connection = queueConnFactory.createConnection();

            logger.debug("got connection  = " + (connection != null));
            session = connection.createSession(Boolean.FALSE, Session.AUTO_ACKNOWLEDGE);

            logger.debug("got Session = " + (session != null));
                        ((MQQueue)requestQueue).setTargetClient(com.ibm.mq.jms.JMSC.MQJMS_CLIENT_NONJMS_MQ);
            producer = session.createProducer(requestQueue);

            Message documentRequestMessage = session.createTextMessage(messageData);

Getting exception during setTargetClient. I also tried setting target client as MQJMS_CLIENT_JMS_COMPLIANT, but still getting same error.

Following jars are in my dependencies -

com.ibm.mqjms-1.0
com.ibm.mq-1.0
com.ibm.dhbcore-61

In Websphere Liberty profile - <feature>wmqJmsClient-2.0</feature> is installed.

<variable name="wmqJmsClient.rar.location" value="${shared.resource.dir}/wmq/jmsra.rar"/> - this is also available on the server

This same application is running on Tomcat without any error.

JoshMc
  • 10,239
  • 2
  • 19
  • 38
Khuzi
  • 2,792
  • 3
  • 15
  • 26
  • `((MQQueue)requestQueue)` Where did `requestQueue` come from? What is its data type? – takendarkk Dec 14 '17 at 21:47
  • Its datatype is javax.jms.Destination. Its getting set through JNDI using autowiring. – Khuzi Dec 14 '17 at 21:52
  • 1
    You are trying to cast the MQ RA JMS Queue object to an MQ JMS MQQueue object and they are not the same type. In Tomcat you wont be using the MQ RA because it doesn't implement the JCA specification. Have you considered using reflection to call setTargetClient? – Alasdair Dec 14 '17 at 23:00
  • What version of IBM MQ are those jar files from? – JoshMc Dec 15 '17 at 00:07

0 Answers0