2
votes

I am attempting to connect to Websphere MQ 6 on Linux 64 bit running in a Sun 1.7 JDK.

I am trying to connect to the MQServer via JNDI looking up objects in LDAP as my application server is separate from the MQ Server and therefore I can't use the file system JNDI.

This all works fine on my development box but there I have 1) Windows and 2) have installed the MQ Server.

I can connect to the LDAP via Websphere MQ Explorer and create the binding objects in the LDAP.

The java application can access the JNDI objects and attempts to create a connection but I get an error java.lang.UnsatisfiedLinkError: no mqjbnd in java.library.path

I have installed the 7.5 client from here

LD_LIBRARY_PATH is set to the defaults after running the command

. /opt/mqm/bin/setmqenv -s -l

The actual path is

LD_LIBRARY_PATH = /usr/java/default/jre/lib/i386:/opt/mqm/lib64/compat:/opt/mqm/lib/compat

I have also explicitly set -Djava.library.path=$LD_LIBRARY_PATH on the JVM.

But when I look at the path /opt/mqm/lib64/compat:/opt/mqm/lib/compat I can't see mqjbnd or anything like it.

A number of posts and tech discussions say that there is no mqjbnd in the client install only the server install. I'm getting confused as I only want to lookup the QueueManager and use the queue items via JNDI - should I just have to install the client rather than the server?

Is the LDAP method the right one for me to use? I attempted to use the com.ibm.mq.jms.context.WMQInitialContextFactory but could never get the security right for that.

Sorry but this is doing my head it - I can't help comparing this to the ease of connecting to ActiveMQ - I must be doing something wrong here.

Exception is

[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
3
This link talks about a similar issue with MQ v7. May be helpful to you. www-01.ibm.com/support/docview.wss?uid=swg21413508Shashi
Thanks for that but I don't actually have the file /opt/mqm/java/lib/libmqjbnd.so mentioned - so maybe I need the server install or something on my application server?Steve666
This part of the exception puzzles me For a client installation this is expectedSteve666
"application server is separate from the MQ Server and therefore I can't use the file system JNDI" Your application server doesn't have a filesystem? Typically, people use the JMSAdmin tool provided by IBM to edit the managed objects either on the MQ server and send the .bindings file to the app folks, or else they use it on the client node and manage it themselves.T.Rob
Also, hover over the websphere-mq tag, then select "info" and there you will find a veritable conrucopia of info to get started, including links to the MQ client downloads, the manuals, etc.T.Rob

3 Answers

0
votes

Ok so the LDAP ConnnectionFactory transport was set to Bindings Mode.

I changed this to client mode as discussed [here][1]

Now I have an issue with authentication but is much better than having an issue with misconfigured or missing native libraries :) - make sure the Connection List points to the right servername(port).

Now I need to sort out authentication...

0
votes

Open Tomcat Server -> Open lauch Configuration -> under Argument tab ->-Djava.library.path="C:\IBM\WebSphere MQ\java\lib64"

it will resolved you exception , its is basically asking for runtime Library

0
votes

The issue is with Path variable on system properties. Try to run code by specifying MQInstallation Dir :\Lib64 path before MQInstallation Dir :\Lib on path variable