线程“main”中的异常java.lang.NoClassDefFoundError:com / ibm / mq / MQException [英] Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/mq/MQException

查看:227
本文介绍了线程“main”中的异常java.lang.NoClassDefFoundError:com / ibm / mq / MQException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行我的程序时,我得到以下异常,


java -jar MQprogram.jar


我已经正确设置了类路径,这是指所有必需的jar,
com.ibm.mq.jmqi.jar也在类路径中引用它有MQException。

 

`线程main中的异常java.lang.NoClassDefFoundError:com / ibm / mq / MQException
引起:java.lang.ClassNotFoundException:com.ibm.mq.MQException
at java.net.URLClassLoader $ 1.run(Unknown Source)
at java.security.AccessController.doPrivileged(原生方法)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher $ AppClassLoader.loadClass(未知来源)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
无法鳍d主要类:com.test.bo.MQprogram。程序将会退出。
`

我还不清楚错误的位置。

解决方案

这几乎总是由不完整的客户端安装和/或CLASSPATH问题的组合引起的。许多人抓住jar文件而不是执行完整安装,并不一定得到所有这些。有时他们只是不断查找jar文件并抓住它们,而不考虑不同的版本。从V7.0开始,IBM执行了Java / JMS类的主要重构,并从那时起进行了一些更新。从V7.0.1开始,WMQ可以安装到任意目录路径和服务器上的多个安装。这意味着现在可以有多个JRE / s,多个客户端安装等。这对CLASSPATH影响不大,但确实改变了依赖性,例如NLS支持,跟踪以及Java类依赖/交互的其他内容。 / p>

建议安装完整的WMQ客户端并将CLASSPATH指向安装目录。如果那是不可能的,那么在某处安装一个完整的客户端 并从已知良好的安装中获取完整的jar集。然后至少你知道你有相同的版本等。



如果您决定从IBM的分发介质安装完整的客户端,您将获得一些额外的功能,例如诊断和低级别的痕迹。它还确保可以应用维护。例如,您遇到的问题已在修订包中得到纠正,您只需在现有客户端安装的顶部安装修订包即可。如果您拥有的只是jar文件,则不会安装Fix Pack。



WMQ客户端可用 SupportPacs 。您可以下载以下内容之一:





请务必使用信息中心作为您正在使用的客户端版本!




I'm getting below exception when i run my program as below,

java -jar MQprogram.jar

I have set classpath correctly which is referring to all required jars , "com.ibm.mq.jmqi.jar" also referred in classpath which has MQException.


`Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/mq/MQException
Caused by: java.lang.ClassNotFoundException: com.ibm.mq.MQException
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: com.test.bo.MQprogram. Program will exit.
`

I'm still unclear where the bug is.

解决方案

This is almost always caused by a combination of an incomplete client install and/or a CLASSPATH issue. Many people grab the jar files rather than performing the complete install and do not necessarily get all of them. Sometimes they just keep looking up jar files and grabbing them, without regard to different versions. IBM performed a major refactor of the Java/JMS classes as of V7.0 and made some updates since then as well. As of V7.0.1, WMQ can be installed to arbitrary directory paths and multiple installs on a server. This meant that there can now be multiple JRE/s, multiple client installs, etc. This didn't affect the CLASSPATH so much but did change dependencies such as NLS support, tracing and other things the Java classes depend on/interact with.

The recommendation is to install a full WMQ client and point the CLASSPATH at the install directory. If that is not possible, then install a full client somewhere and grab the complere set of jars from the known-good installation. Then at least you know you have all the same version, etc.

Should you decide to install the full client from IBM's distribution media, you get several additional capabilities such as diagnostics and low-level trace. It also assures that maintenance can be applied. For example, you have a problem that is corrected in a Fix Pack, you simply install the Fix Pack over top of the existing client install. The Fix Pack won't install if all you have are the jar files.

The WMQ clients are available as SupportPacs. You can download one of the following:

Be sure to use the Infocenter for the version of client you are using!

这篇关于线程“main”中的异常java.lang.NoClassDefFoundError:com / ibm / mq / MQException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆