Sindhuri Devatha
Sindhuri Devatha

Reputation: 7

Upgrade of Java 8 and MQ - NoClassDEfFoundError

we recently upgraded our code to Java 8. As part of it MQ was also upgraded to MQ 9. We are using two components jms(7.0.1.6) and jmqi(7.0.1.6) earlier. Now we replaced both the jars with allclient and tracecontrol of MQ 9.0.0.0 JAR.

2017-10-24 02:30:07 INFO  server.SqlService<start:29> -  SQL
Exception in thread "main" java.lang.NoClassDefFoundError: javax/jms/JMSRuntimeException
    at com.ibm.mq.jms.MQDestination.<clinit>(MQDestination.java:71)
    at com.epo.core.server.config.LdapConfig.getQueue(LdapConfig.java:213)
    at com.epo.core.server.MqService.start(MqService.java:77)
    at com.epo.core.service.ServiceGroup.start(ServiceGroup.java:90)
    at com.epo.core.service.ServiceGroup.startAll(ServiceGroup.java:76)
    at com.epo.core.service.ServiceGroup.start(ServiceGroup.java:70)
    at com.epo.server.dispatcher.DispatcherProcess.initializeServices(DispatcherProcess.java:380)
    at com.epo.server.dispatcher.DispatcherProcess.run(DispatcherProcess.java:320)
    at com.epo.server.dispatcher.DispatcherProcess.main(DispatcherProcess.java:200)
Caused by: java.lang.ClassNotFoundException: javax.jms.JMSRuntimeException
    at java.net.URLClassLoader.findCl`enter code here`ass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 9 more

Please let me know why I am getting NoClassDefFoundError.

Upvotes: 1

Views: 11365

Answers (2)

JoshMc
JoshMc

Reputation: 10652

As stated by a_cornish_pasty you are likely missing the jms.jar or have an older version.

For IBM MQ Classes for JMS you can find the list of files required on the IBM MQ v9 Knowledge Center page "What is installed for IBM MQ classes for JMS":

Relocatable JAR files
Within an enterprise, the following files can be moved to systems that need to run IBM MQ classes for JMS:

  • com.ibm.mq.allclient.jar
  • com.ibm.mq.traceControl.jar
  • jms.jar
  • fscontext.jar
  • providerutil.jar
  • The Bouncy Castle security provider and CMS support jars

The fscontext.jar and providerutil.jar files are required if your application performs JNDI lookups using a file system context.

The Bouncy Castle security provider and CMS support jar files are required. For more information, see Support for non-IBM JREs.

Note that only com.ibm.mq.allclient.jar, jms.jar, and the Bouncy Castle security provider and CMS support jars are included in the Redistributable client, but all are included in Java All client. You are also running 9.0.0.0 and I would recommend you go to 9.0.0.2. You can find both the Redistributable and Java All clients on Fix Central.

Upvotes: 0

a_cornish_pasty
a_cornish_pasty

Reputation: 816

You're getting the exception:

java.lang.ClassNotFoundException: javax.jms.JMSRuntimeException

because you don't have the JMS v2.0 jar on your classpath. You're probably still using the JMS v1.1 jar.

Look at how your application configures its Java classpath to correct the issue.

Note that if you didn't copy the MQ client libraries around, and just referenced the com.ibm.mq.allclient.jar file on the Java classapth from a real MQ client install, you wouldn't have this problem as the JMS v2.0 jar will exist alongside the allclient jar in the MQ_INSTALLATION_DIR/java/lib directory and would be pulled into auto-magically.

Upvotes: 1

Related Questions