IBM MQ Java错误:: java.lang.ClassNotFoundException:com.ibm.mq.internal.MQCommonServices [英] IBM MQ Java Error :: java.lang.ClassNotFoundException: com.ibm.mq.internal.MQCommonServices

查看:223
本文介绍了IBM MQ Java错误:: java.lang.ClassNotFoundException:com.ibm.mq.internal.MQCommonServices的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从MQMessage对象使用MQHeaderIterator提取MQHeaders时,出现以下错误.我正在使用下面的代码行,并得到下面的异常.在类路径中的jar下面也添加了它,但仍然显示错误.

I am getting the below error while trying to extract the MQHeaders using MQHeaderIterator from MQMessage object . I am using the below line of code and getting the below Exception. Added below jar in classpath also but still it showing error.

使用的库:

com.ibm.mq.jar
com.ibm.mq.headers.jar
com.ibm.mq.commonservices.jar
com.ibm.mq.jmqi.jar
com.ibm.mq.pcf.jar

代码:

//Giving error in this line
MQHeaderIterator it = new MQHeaderIterator(theMessage);

其引发异常,如下所示.

Its throwing Exception as below.

Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/mq/internal/MQCommonServices
    at com.ibm.mq.headers.MQHeaderIterator.<init>(MQHeaderIterator.java:112)
    at com.test.mq.util.MQClass.main(MQClass.java:69)
Caused by: java.lang.ClassNotFoundException: com.ibm.mq.internal.MQCommonServices
    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)
    ... 2 more

请提出此错误的可能原因,主要是当缺少某些jar文件时发生ClassNot Found错误.我在这里想念什么吗?

Please suggest the possible reason for this error mostly ClassNot Found error occurs when some jar file is missing. Am i missing something here?

推荐答案

简单回答,将类路径指向原始IBM MQ安装位置的java/lib目录,该位置包含 ALL 所需的jar文件.

Short answer, point the classpath to the java/lib directory of the original IBM MQ install location which contains ALL required jar files.

更多细节:

IBM在v8之前不支持将jar文件复制到其他位置,在这种情况下,它们增加了对重定位的支持,但是将所需的所有内容组合到两个jar文件com.ibm.mq.allclient.jar和com.ibm.mq.traceControl .jar,可以将其从完整的MQ Server或MQ Client安装中重新定位到企业中的其他位置.

IBM does not support copying jar files to different locations until v8 in which case they have added support for relocation but have combined everything needed into two jar files com.ibm.mq.allclient.jar and com.ibm.mq.traceControl.jar which can be relocated from a full MQ Server or MQ Client install to another location in your enterprise.

有关更多详细信息,请参阅IBM技术说明"从MQ 8.0开始,您可以使用可重定位的JAR文件".

For more details see the section "Starting with MQ 8.0, you can use Relocatable JAR Files" on IBMs Technote "Starting with MQ 8.0, you can use Relocatable JAR Files".

WebSphere MQ 8.0.0> IBM MQ>开发应用程序>开发 IBM MQ的面向对象应用程序>将IBM MQ类用于 Java> Java的IBM MQ类的安装和配置> 什么是为Java的IBM MQ类安装的

WebSphere MQ 8.0.0 > IBM MQ > Developing applications > Developing object-oriented applications with IBM MQ > Using IBM MQ classes for Java > Installation and configuration of IBM MQ classes for Java > What is installed for IBM MQ classes for Java

可重定位的JAR文件

在企业内部,可以将以下文件移动到系统中 需要为Java应用程序运行IBM MQ类的

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

  • com.ibm.mq.allclient.jar
  • com.ibm.mq.traceControl.jar

文件com.ibm.mq.allclient.jar包含用于以下方面的IBM MQ类 JMS,Java的IBM MQ类以及PCF和Headers类.如果 您将此文件移动到新位置,请确保采取以下步骤: 使用新的IBM MQ修订包来维护此新位置.还, 确保在以下情况下,IBM支持人员可以知道此文件的使用情况: 您将获得临时修订.

The file com.ibm.mq.allclient.jar contains the IBM MQ classes for JMS, the IBM MQ classes for Java, and the PCF and Headers Classes. If you move this file to a new location, make sure that you take steps to keep this new location maintained with new IBM MQ Fix Packs. Also, make sure that the use of this file is made known to IBM Support if you are getting an interim fix.

要确定文件com.ibm.mq.allclient.jar的版本,请使用 命令:java -jar com.ibm.mq.allclient.jar

To determine the version of the file com.ibm.mq.allclient.jar, use the command: java -jar com.ibm.mq.allclient.jar


请注意,所有MQ版本7.1和更早版本都是IBM的服务终止. IBM MQ v7.5的服务终止日期为2018年4月30日.


Note that all MQ versions 7.1 and earlier are end of service from IBM. IBM MQ v7.5 has an end of service date of April 30th 2018.

我建议您转到尚未宣布终止服务日期的v8.0或v9.0.较新的MQ客户端版本可以连接到较旧的MQ队列管理器.您可以在以下链接中下载仅Java安装的MQ 8.0或MQ 9.0 jar文件:

I would recommend you move to v8.0 or v9.0 which have not had end of service dates announced yet. Newer MQ client versions can connect to older MQ queue managers. You can download a java only install of MQ 8.0 or MQ 9.0 jar files at the links below:

  • IBM MQ v8.0 Client
  • IBM MQ v9.0 Client

这篇关于IBM MQ Java错误:: java.lang.ClassNotFoundException:com.ibm.mq.internal.MQCommonServices的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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