Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoClassDefFoundError: com/ibm/mq/MQException

Tags:

ibm-mq

This is similar to the earlier question Exception in thread “main” java.lang.NoClassDefFoundError: com/ibm/mq/MQException

I am facing a similar issue in Linux. I have installed the following:

MQSeriesRuntime-7.0.1-3.x86_64.rpm
MQSeriesSDK-7.0.1-3.x86_64.rpm
MQSeriesJava-7.0.1-3.x86_64.rpm
MQSeriesServer-7.0.1-3.x86_64.rpm

When I create an execution group , I get:
java.lang.ClassNotFoundException: com.ibm.mq.MQException

I have CLASSPATH set by using this line of code:
export CLASSPATH=$CLASSPATH:/opt/mqm/java/lib/com.ibm.mq.jmqi.jar:/opt/mqm/java/lib/com.ibm.mq.jar:.

Version of broker is 8.0.0.1 and that of MQ is 7.0.1.3 . Can you please suggest what is wrong? According to the previous answer, am I supposed to install the Client also?

like image 619
Tanu Avatar asked Dec 14 '12 15:12

Tanu


2 Answers

You need to review the WMQ Using Java manual for WMQ v7.0.1.*, as you are missing MQ JAR files.

For MQ base Java (not MQ/JMS), you need at least 5 MQ JAR files:

  • com.ibm.mq.jar
  • connector.jar
  • com.ibm.mq.jmqi.jar
  • com.ibm.mq.headers.jar
  • com.ibm.mq.commonservices.jar
like image 74
Roger Avatar answered Nov 09 '22 08:11

Roger


No, you do not need to install the client. The response in the other question was based on having a non-standard install of the client jars. In this case, you appear to have a standard install of WMQ Server. In addition to the RPMs you have provided, there is also an RPM for the MQSeries JRE, although I do not expect that to be the issue here. You obviously have some JRE, presumably the one installed by Broker.

So this should come down to a case of differential diagnosis. Divide and conquer.

  1. Did you run the MQIVT program or any other Java program successfully? If you did and forced an exception, what happened? This tells us if it is system-wide or limited to the Broker's environment.
  2. Where do you export the CLASSPATH? In the broker account's .profile? The broker startup script? Are you sure it gets parsed on start of the broker?
  3. Why not use the /opt/mqm/java/bin/setjmsenv command as described in Environment variables relevant to WebSphere MQ classes for Java? Sourcing this script in the broker startup script would capture all the relevant classes and do so in a way that is intended to work consistently as you upgrade to later versions.
  4. Which JRE are you using? If it is not the one installed with Broker, it may be the wrong version or from a non-supported JRE provider.

There's not enough information in the posted question to provide a confident answer but answering these diagnostic questions should help narrow it down or solve it altogether.

like image 20
T.Rob Avatar answered Nov 09 '22 10:11

T.Rob