'java.lang.NoClassDefFoundError: com/ibm/mq/MQException
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?
Solution 1:[1]
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.
- 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.
- 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?
- 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. - 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.
Solution 2:[2]
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
Solution 3:[3]
Errors occurred in windows 10 enterprise edition after moving from MQSERIES 7
to MQSERIES 9
version of the server. My Client continue to use MQS version 7 client java libraries.
After adding to classpath
:
com.ibm.mq.jar; connector.jar; com.ibm.mq.jmqi.jar;
com.ibm.headers.jar;com.ibm.mq.commonservices.jar
"old" program succeeded to connect with the server.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | T.Rob |
Solution 2 | Roger |
Solution 3 | Tyler2P |