Alon
Alon

Reputation: 75

Failing to connect MQ with java 11

After upgrading to JDK 11 from JDK 8 and MQ 9.2.0.5 (from 9.2.0.4), i'm getting the below error when trying to open JMS connection.

I'm running on WLS 14.

I also upgraded allclient.jar to 9.2.0.5.

I tried running it with previous MQ (9.2.0.4) which worked fine with java 8, i get the same issue. Same code works fine with MQ 9.2.0.4, JDK 8 and WLS 12.

I verified that method exists in jar and verified no other versions of allclient jars exists.

com.ibm.mq.jmqi.JmqiException: CC=2;RC=2195;AMQ9546: Error return code received. [1=java.lang.NoSuchMethodException[com.ibm.mq.jmqi.remote.api.RemoteFAP.(com.ibm.mq.jmqi.JmqiEnvironment, int)],3=Class.getConstructor0] at com.ibm.mq.jmqi.JmqiEnvironment.getInstance(JmqiEnvironment.java:857) at com.ibm.mq.jmqi.JmqiEnvironment.getMQI(JmqiEnvironment.java:702) at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:8437) at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:7815) at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl._createConnection(JmsConnectionFactoryImpl.java:322) at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:242) at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6026) at com.ibm.mq.jms.MQConnectionFactory.createConnection(MQConnectionFactory.java:6086) at org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter.doCreateConnection(UserCredentialsConnectionFactoryAdapter.java:188) at . Caused by: java.lang.NoSuchMethodException: com.ibm.mq.jmqi.remote.api.RemoteFAP.(com.ibm.mq.jmqi.JmqiEnvironment, int) at java.base/java.lang.Class.getConstructor0(Class.java:3349) at java.base/java.lang.Class.getConstructor(Class.java:2151) at com.ibm.mq.jmqi.JmqiEnvironment.getInstance(JmqiEnvironment.java:764)

Upvotes: 2

Views: 1780

Answers (2)

drdonna
drdonna

Reputation: 26

Remove if you have com.ibm.* related packages in prefer-application-packages section in weblogic.xml.

Upvotes: 1

Roger
Roger

Reputation: 7456

I just ran a couple of Java/JMS applications using OpenJDK 11 and they ran fine. I agree with Doug Grove that you probably have a mismatch of MQ JAR files.

Add the following line to your code and then update your question with the output:

System.out.println("java.class.path="+System.getProperty("java.class.path"));

If you want to get fancy then you can do:

if (null != System.getProperty("java.class.path"))
{
   if (System.getProperty("os.name").startsWith("Windows"))
      System.out.println("java.class.path=\n"+(System.getProperty("java.class.path")).replace(';', '\n'));
   else
      System.out.println("java.class.path\n="+(System.getProperty("java.class.path")).replace(':', '\n'));
}

Upvotes: 1

Related Questions