我正在尝试连接到在 Sun 1.7 JDK 中运行的 Linux 64 位上的 Websphere MQ 6。
我试图通过 JNDI 连接到 MQServer,在 LDAP 中查找对象,因为我的应用程序服务器与 MQ 服务器是分开的,因此我不能使用文件系统 JNDI。
这一切在我的开发盒上都可以正常工作,但是我有 1) Windows 和 2) 已经安装了 MQ 服务器。
我可以通过 Websphere MQ Explorer 连接到 LDAP 并在 LDAP 中创建绑定对象。
Java 应用程序可以访问 JNDI 对象并尝试创建连接,但出现错误 java.lang.UnsatisfiedLinkError: no mqjbnd in java.library.path
我已经从这里安装了 7.5 客户端
运行命令后 LD_LIBRARY_PATH 设置为默认值
. /opt/mqm/bin/setmqenv -s -l
实际路径是
LD_LIBRARY_PATH = /usr/java/default/jre/lib/i386:/opt/mqm/lib64/compat:/opt/mqm/lib/compat
我还在 JVM 上明确设置了 -Djava.library.path=$LD_LIBRARY_PATH。
但是当我查看路径 /opt/mqm/lib64/compat:/opt/mqm/lib/compat 时,我看不到 mqjbnd 或类似的东西。
许多帖子和技术讨论说客户端安装中没有mqjbnd只有服务器安装。我很困惑,因为我只想查找 QueueManager 并通过 JNDI 使用队列项——我应该只需要安装客户端而不是服务器吗?
LDAP 方法是否适合我使用?我尝试使用 com.ibm.mq.jms.context.WMQInitialContextFactory 但永远无法获得安全权限。
抱歉,这让我很头疼——我不禁将其与连接到 ActiveMQ 的便利性进行比较——我一定是在这里做错了。
例外是
[2013-03-13 14:32:41,389] ERROR - ServiceTaskManager Error acquiring a JMS connection to : cn=ConnectionFactoryLdap using JNDI properties : {java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory, java.naming.provider.url=ldap://LDAPSERVER:10389/dc=example,dc=com, transport.jms.ConnectionFactory=ibmMQQueueConnectionFactory, transport.jms.ConnectionFactoryType=queue, serviceType=proxy}
com.ibm.msg.client.jms.DetailedJMSException: JMSFMQ6312: An exception occurred in the Java(tm) MQI.
The Java(tm) MQI has thrown an exception describing the problem.
See the linked exception for further information.
at sun.reflect.GeneratedConstructorAccessor30.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at com.ibm.msg.client.commonservices.j2se.NLSServices.createException(NLSServices.java:319)
at com.ibm.msg.client.commonservices.nls.NLSServices.createException(NLSServices.java:233)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:6863)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:6254)
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:285)
at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6189)
at com.ibm.mq.jms.MQConnectionFactory.createConnection(MQConnectionFactory.java:6218)
at org.apache.axis2.transport.jms.JMSUtils.createConnection(JMSUtils.java:555)
at org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.createConnection(ServiceTaskManager.java:824)
at org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.getConnection(ServiceTaskManager.java:706)
at org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.receiveMessage(ServiceTaskManager.java:496)
at org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.run(ServiceTaskManager.java:420)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2495;AMQ8568: The native JNI library 'mqjbnd' was not found. For a client installation this is expected. [3=mqjbnd]
at com.ibm.mq.jmqi.local.LocalMQ$1.run(LocalMQ.java:304)
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.mq.jmqi.local.LocalMQ.initialise_inner(LocalMQ.java:268)
at com.ibm.mq.jmqi.local.LocalMQ.initialise(LocalMQ.java:231)
at com.ibm.mq.jmqi.local.LocalMQ.<init>(LocalMQ.java:1194)
at com.ibm.mq.jmqi.local.LocalServer.<init>(LocalServer.java:206)
at sun.reflect.GeneratedConstructorAccessor29.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at com.ibm.mq.jmqi.JmqiEnvironment.getInstance(JmqiEnvironment.java:732)
at com.ibm.mq.jmqi.JmqiEnvironment.getMQI(JmqiEnvironment.java:666)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:6855)
... 13 more
Caused by: java.lang.UnsatisfiedLinkError: no mqjbnd in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at com.ibm.mq.jmqi.local.LocalMQ.loadLib(LocalMQ.java:1138)
at com.ibm.mq.jmqi.local.LocalMQ$1.run(LocalMQ.java:279)
... 24 more