[英]Connecting to MQ manager get MQ error 2495
We have an application that was fully working in staging but when we deploy it on production we are getting MQ error 2495. We are running the application in a Tomcat 8.5 and we are using the same MQ libraries (8.0.0.6). 我们有一个可以在登台阶段完全正常工作的应用程序,但是当将其部署到生产环境中时,会出现MQ错误2495。我们在Tomcat 8.5中运行该应用程序,并且使用的是相同的MQ库(8.0.0.6)。 The server OS is Windows.
服务器操作系统是Windows。
The code for reading the message from the MQ looks like: 从MQ读取消息的代码如下:
MQEnvironment.hostname = queueSettings.getServer();
MQEnvironment.channel = queueSettings.getChannel();
MQEnvironment.port = queueSettings.getPort();
MQQueueManager queueManager = new MQQueueManager(queueSettings.getQueueManager());
int openOptions = CMQC.MQCBDO_FAIL_IF_QUIESCING | CMQC.MQOO_INPUT_SHARED | CMQC.MQOO_BROWSE;
MQQueue queue = queueManager.accessQueue(queueSettings.getQueue(), openOptions);
De full stacktrace of the error looks like: 错误的完整堆栈跟踪看起来像:
com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2495'.
at com.ibm.mq.MQSESSION.(MQSESSION.java:2063)
at com.ibm.mq.MQSESSION.getSession(MQSESSION.java:2103)
at com.ibm.mq.MQManagedConnectionJ11.(MQManagedConnectionJ11.java:207)
at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11._createManagedConnection(MQBindingsManagedConnectionFactoryJ11.java:185)
at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11.createManagedConnection(MQBindingsManagedConnectionFactoryJ11.java:230)
at com.ibm.mq.StoredManagedConnection.(StoredManagedConnection.java:96)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:194)
at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:758)
at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:706)
at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:670)
at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:145)
at com.ibm.mq.MQQueueManager.(MQQueueManager.java:675)
at com.atlascopco.cpq.connections.MQConnection.readMessagesFromQueue(MQConnection.java:92)
at com.atlascopco.cpq.tasks.ResponseHandlerTask.run(ResponseHandlerTask.java:43)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2495;AMQ8568: The native JNI library 'mqjbnd64' was not found. For a client installation this is expected. [3=mqjbnd64]
at com.ibm.mq.jmqi.local.LocalMQ.loadLib(LocalMQ.java:1202)
at com.ibm.mq.jmqi.local.LocalMQ$1.run(LocalMQ.java:272)
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.mq.jmqi.local.LocalMQ.initialise_inner(LocalMQ.java:260)
at com.ibm.mq.jmqi.local.LocalMQ.initialise(LocalMQ.java:223)
at com.ibm.mq.jmqi.local.LocalMQ.(LocalMQ.java:1255)
at com.ibm.mq.jmqi.local.LocalServer.(LocalServer.java:219)
at sun.reflect.GeneratedConstructorAccessor10933.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.ibm.mq.jmqi.JmqiEnvironment.getInstance(JmqiEnvironment.java:656)
at com.ibm.mq.jmqi.JmqiEnvironment.getMQI(JmqiEnvironment.java:590)
at com.ibm.mq.MQSESSION.(MQSESSION.java:2056)
... 15 common frames omitted
Caused by: java.lang.UnsatisfiedLinkError: no mqjbnd64 in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.ibm.mq.jmqi.local.LocalMQ.loadLib(LocalMQ.java:1146)
... 27 common frames omitted
How can I find the issue? 我如何找到问题?
The issue is in your stack trace: 问题出在您的堆栈跟踪中:
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2495;AMQ8568: The native JNI library 'mqjbnd64' was not found. For a client installation this is expected. [3=mqjbnd64]
Caused by: java.lang.UnsatisfiedLinkError: no mqjbnd64 in java.library.path
This is documented on the IBM MQ Knowledge center page " Configuring the Java Native Interface (JNI) libraries " 在IBM MQ知识中心页面“ 配置Java本机接口(JNI)库 ”中对此进行了记录。
On windows the default location for the libraries are below: 在Windows上,库的默认位置如下:
MQ_INSTALLATION_PATH\java\lib (32-bit libraries)
MQ_INSTALLATION_PATH\java\lib64 (64-bit libraries)
You can specify the location of this library one of two ways (both examples below would be for a 64bit JRE if MQ is installed in the default location, if you are running a 32bit JRE use the lib
directory instead of the lib64
directory): 您可以使用以下两种方法之一来指定该库的位置(如果在默认位置安装了MQ,则下面的两个示例都是针对64位JRE的;如果运行的是32位JRE,请使用
lib
目录而不是lib64
目录):
-Djava.library.path=C:\\Program Files\\IBM\\MQ\\java\\lib64
set PATH=C:\\Program Files\\IBM\\MQ\\java\\lib64;%PATH%
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.