Reputation: 1628
Problem Description :
I have installed MQ Server and MQ Client both with version 9.0. I have defined a Queue Manager and Queues and Topics. I am using Java 7. I have developed a standalone java client to connect to the Queue Manager in BINDING mode. The java application and MQ are being hosted on the same server, so BINDING connection has its necessary pre-requisites.
However when I am trying to run my application I am getting an error :
Exception in thread "main" java.lang.UnsatisfiedLinkError: mqjbnd05 (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1279)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1245)
at java.lang.System.loadLibrary(System.java:540)
at com.ibm.mq.MQSESSION.loadLib(MQSESSION.java:872).....
Have searched a few topics related to this but couldn't find any definite solution. I am pasting my java code below :
/**
*
*/
package com.binding;
import javax.jms.JMSException;
import javax.jms.Session;
import com.ibm.jms.JMSMessage;
import com.ibm.jms.JMSTextMessage;
import com.ibm.mq.jms.JMSC;
import com.ibm.mq.jms.MQQueue;
import com.ibm.mq.jms.MQQueueConnection;
import com.ibm.mq.jms.MQQueueConnectionFactory;
import com.ibm.mq.jms.MQQueueReceiver;
import com.ibm.mq.jms.MQQueueSender;
import com.ibm.mq.jms.MQQueueSession;
/**
* @author Som
*
*/
public class MQBindingConnection {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
MQQueueConnectionFactory cf = new MQQueueConnectionFactory();
// Config
//cf.setHostName("localhost");
//cf.setPort(1414);
cf.setTransportType(JMSC.MQJMS_TP_BINDINGS_MQ);
cf.setQueueManager("QM.E001");
//cf.setChannel("SYSTEM.DEF.SVRCONN");
MQQueueConnection connection = (MQQueueConnection) cf.createQueueConnection("user","pass");
MQQueueSession session = (MQQueueSession) connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
MQQueue queue = (MQQueue) session.createQueue("BINDING.CONN");
MQQueueSender sender = (MQQueueSender) session.createSender(queue);
MQQueueReceiver receiver = (MQQueueReceiver) session.createReceiver(queue);
long uniqueNumber = System.currentTimeMillis() % 1000;
JMSTextMessage message = (JMSTextMessage) session.createTextMessage("SimplePTP "+ uniqueNumber);
// Start the connection
connection.start();
sender.send(message);
System.out.println("Sent message:\\n" + message);
JMSMessage receivedMessage = (JMSMessage) receiver.receive(10000);
System.out.println("\\nReceived message:\\n" + receivedMessage);
sender.close();
receiver.close();
session.close();
connection.close();
System.out.println("\\nSUCCESS\\n");
}
catch (JMSException jmsex) {
System.out.println(jmsex);
System.out.println("\\nFAILURE\\n");
}
catch (Exception ex) {
System.out.println(ex);
System.out.println("\\nFAILURE\\n");
}
}
}
I could not find the file "mqjbnd05" in the directory location : C:\Program Files\IBM\MQ\java\lib Also in lib64 path I have checked but the file is missing. C:\Program Files\IBM\MQ\java\lib64
I have set my CLASSPATH variable to point to the correct MQ lib directory.
I have tried changing the lib directory location to both server and client, however, the file "mqjbnd05" is missing everywhere, so as expected same error is encountered.
The same piece of code using the commented out sections is running fine for CLIENT mode.Please let me know what else I am missing out for connecting in BINDING mode.
I am using the following ENV variables :
MQ_JAVA_LIB_PATH = C:\Program Files\IBM\MQ\java\lib64;C:\Program Files\IBM\MQ\java\lib
MQ_FILE_PATH = C:\Program Files\IBM\MQ
MQ_JAVA_DATA_PATH = C:\ProgramData\IBM\MQ
MQ_JAVA_INSTALL_PATH = C:\Program Files\IBM\MQ\java
MQ_JRE_PATH = C:\Program Files\IBM\MQ\java\jre
LIB = C:\Program Files\IBM\MQ\tools\lib64;C:\IBM\SQLLIB\LIB;C:\Program Files\IBM\MQ\tools\lib
CLASSPATH = C:\Program Files\IBM\MQ\java\lib\com.ibm.mqjms.jar;C:\Program Files\IBM\MQ\java\lib\com.ibm.mq.jar;C:\Program Files\IBM\MQ\java\lib;C:\Program Files\IBM\MQ\java\lib64;
One thing to add is : I have the file mqjbnd.dll but not the mqjbnd05
Upvotes: 0
Views: 2023
Reputation: 2026
mqjbnd05 was removed from the MQ product in MQ v7, prefering instead to use a generic mqjbnd with an interface which worked across subsequent releases. However, that means if you are running a Java application and picking up MQ v6 or earlier jar files, but with an MQ product install of post-MQv6 then you will get the error you report. There are no references I can find to mqjbnd05 in the MQv9 codebase.
Given you said in a comment you have mqjbnd.dll and MQServer+MQClient v9, then the only way I can think of to achieve this is either you are picking up jars from pre-MQv7 from the classpath, or that you have build your application and included within your application the MQ jars themsevles.
Depending on how you run your application, you could try adding the -verbose option to the java launch to see where the MQ jars are coming from.
Upvotes: 3