The Java application is complaining about an unsatisfied JNI library.
You have to add the shared library "mqjbnd02" to the execution path.
Find it under the <MQ_INSTALL_DIR> (I believe it is under bin or java)
and add it to your PATH variable (if you're using Windows).
Regards,
Denilson
==================================================
Notes: Denilson Nastacio/Raleigh/IBM@IBMUS
Internet: [EMAIL PROTECTED]
Phone: +1 (919) 224-1743 Fax: 919-224-2580
RTP 510/4F47
| "Reddy, Harish S" <[EMAIL PROTECTED]>
Sent by: MQSeries List <[EMAIL PROTECTED]> 05/10/2002 06:59 PM
|
To: [EMAIL PROTECTED] cc: Subject: Error when trying java binding MQSample program. |
When trying the MQSeries java binding connection my program outputs the
following stacked error. Listed is the program followed by the exception
stack. Has anyone got ideas on what is causing the error. I have replaced
the local queueManager and queue names with aliases.
The sample program,
import com.ibm.mq.*; // Include the MQSeries classes for Java package
//import java.util.Hashtable; // Required for properties
public class MQSample
{
private static String qManager = "QUMANAGER"; // define name of queue
manager
private static MQQueueManager qMgr; // define a queue manager
public static void main(String args[]) {
try {
java.util.Hashtable properties;
properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES_BINDINGS);
properties.put(MQC.HOST_NAME_PROPERTY,"ipaddress");
properties.put(MQC.CHANNEL_PROPERTY,"QUMANAGER.CLIENT");
properties.put(MQC.PORT_PROPERTY,1414);
qMgr = new MQQueueManager(qManager, properties);
// Set up the options on the queue we wish to open...
/ Note. All MQSeries Options are prefixed with MQC in Java.
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF |
MQC.MQOO_OUTPUT ;
// Now specify the queue that we wish to open,
// and the open options...
MQQueue lQueue = qMgr.accessQueue("lQueue",
openOptions,
null, // default q manager
null, // no dynamic
q name
null); // no alternate user id
// Define a simple MQSeries message, and write some text in UTF format..
MQMessage hello_world = new MQMessage();
hello_world.writeUTF("Hello World!");
// specify the message options...
MQPutMessageOptions pmo = new MQPutMessageOptions(); // accept the //
defaults,
// same as MQPMO_DEFAULT
// put the message on the queue
l Queue.put(hello_world,pmo);
// get the message back again...
// First define a MQSeries message buffer to receive the message into..
MQMessage retrievedMessage = new MQMessage();
retrievedMessage.messageId = hello_world.messageId;
// Set the get message options...
MQGetMessageOptions gmo = new MQGetMessageOptions(); // accept the defaults
// same as MQGMO_DEFAULT
// get the message off the queue...
lQueue.get(retrievedMessage, gmo);
// And prove we have the message by displaying the UTF message text
String msgText = retrievedMessage.readUTF();
System.out.println("The message is: " + msgText);
// Close the queue...
lQueue.close();
// Disconnect from the queue manager
qMgr.disconnect();
}
// If an error has occurred in the above, try to identify what went wrong
// Was it an MQSeries error?
catch (MQException ex) {
System.out.println("An MQSeries error occurred : Completion code " +
ex.completionCode + " Reason code " + ex.reasonCode);
}
// Was it a Java buffer space error?
catch (java.io.IOException ex) {
System.out.println("An error occurred whilst writing to the message buffer:
" + ex);
}
}
} // end of sample
The exception stack
Exception in thread "main" java.lang.UnsatisfiedLinkError: no mqjbnd02 in
java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1410)
at java.lang.Runtime.loadLibrary0(Runtime.java:772)
at java.lang.System.loadLibrary(System.java:832)
at com.ibm.mq.server.MQSESSION.<clinit>(MQSESSION.java:145)
at com.ibm.mq.MQSESSIONServer.getMQSESSION(MQSESSIONServer.java:67)
at com.ibm.mq.MQSESSION.getSession(MQSESSION.java:209)
at
com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:148)
at
com.ibm.mq.MQBindingsManagedConnectionFactoryJ11._createManagedConnection(MQ
BindingsManagedConnectionFactoryJ11.java:136)
at
com.ibm.mq.MQBindingsManagedConnectionFactoryJ11.createManagedConnection(MQB
indingsManagedConnectionFactoryJ11.java:154)
at
com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:80)
at
com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionMa
nager.java:150)
at
com.ibm.mq.MQQueueManager.obtainBaseMQQueueManager(MQQueueManager.java:649)
at com.ibm.mq.MQQueueManager.construct(MQQueueManager.java:598)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:375)
at MQSample.main(MQSample.java:14)
Thank you,
Harish
Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive
