IBM® WebSphere® MQ classes for JMS applications,
that either connect to a queue manager using the bindings transport, or that connect to a queue
manager using the client transport, and use the channel exit programs written in languages other
than Java, need to be run in an environment that accesses the Java Native Interface (JNI)
libraries.
About this task
To set up this environment, you must configure the environment's library path so that the Java virtual
machine (JVM) can load the mqjbnd library before you start the IBM WebSphere MQ classes for JMS application.
IBM WebSphere MQ provides two Java Native Interface (JNI) libraries:
- mqjbnd
- This library is used by applications that connect to a queue manager using the bindings
transport. It provides the interface between the IBM WebSphere MQ classes for JMS and the queue manager. The mqjbnd library installed with
IBM WebSphere MQ Version 7.5 can be used to connect to any
IBM WebSphere MQ Version 7.5 (or earlier) queue manager.
- mqjexitstub02
- The mqjexitstub02 library is loaded by the IBM WebSphere MQ classes for JMS when an application connects
to a queue manager using the client transport and uses a channel exit program written in a language
other than Java.
On certain platforms, IBM WebSphere MQ installs 32-bit
and 64-bit versions of these JNI libraries. The location of the libraries for each platform is shown
in Table 1
Table 1. The location of the IBM WebSphere MQ classes for
JMS libraries for each platform
Platform |
Directory containing the IBM WebSphere MQ classes for JMS libraries |
AIX® |
MQ_INSTALLATION_PATH /java/lib (32 bit libraries)
MQ_INSTALLATION_PATH /java/lib64 (64 bit libraries)
|
HP-UX |
MQ_INSTALLATION_PATH /java/lib (32 bit libraries)
MQ_INSTALLATION_PATH /java/lib64 (64 bit libraries)
|
Linux (POWER®
, x86-64
and
zSeries s390x platforms)
|
MQ_INSTALLATION_PATH /java/lib (32 bit libraries)
MQ_INSTALLATION_PATH /java/lib64 (64 bit libraries)
|
Linux (x86 platform)
Linux (
zSeries platform)
|
MQ_INSTALLATION_PATH /java/lib |
Solaris (x86-64 and SPARC platforms) |
MQ_INSTALLATION_PATH /java/lib (32 bit libraries)
MQ_INSTALLATION_PATH /java/lib64 (64 bit libraries)
|
Windows |
MQ_INSTALLATION_PATH \java\lib (32 bit libraries)
MQ_INSTALLATION_PATH \java\lib64 (64 bit libraries)
|
MQ_INSTALLATION_PATH represents the high-level
directory in which IBM WebSphere MQ is installed.
|
Procedure
-
Configure the JVM's java.library.path property, which can be done in two
ways:
An example of the exception stack that you see when the environment has not been configured
correctly is as
follows:
Caused by: com.ibm.mq.jmqi.local.LocalMQ$4: CC=2;RC=2495;
AMQ8598: Failed to load the WebSphere MQ native JNI library: 'mqjbnd'.
at com.ibm.mq.jmqi.local.LocalMQ.loadLib(LocalMQ.java:1268)
at com.ibm.mq.jmqi.local.LocalMQ$1.run(LocalMQ.java:309)
at java.security.AccessController.doPrivileged(AccessController.java:400)
at com.ibm.mq.jmqi.local.LocalMQ.initialise_inner(LocalMQ.java:259)
at com.ibm.mq.jmqi.local.LocalMQ.initialise(LocalMQ.java:221)
at com.ibm.mq.jmqi.local.LocalMQ.<init>(LocalMQ.java:1350)
at com.ibm.mq.jmqi.local.LocalServer.<init>(LocalServer.java:230)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:86)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:58)
at java.lang.reflect.Constructor.newInstance(Constructor.java:542)
at com.ibm.mq.jmqi.JmqiEnvironment.getInstance(JmqiEnvironment.java:706)
at com.ibm.mq.jmqi.JmqiEnvironment.getMQI(JmqiEnvironment.java:640)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:8437)
... 7 more
Caused by: java.lang.UnsatisfiedLinkError: mqjbnd (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1235)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1205)
at java.lang.System.loadLibrary(System.java:534)
at com.ibm.mq.jmqi.local.LocalMQ.loadLib(LocalMQ.java:1240)
... 20 more
-
After either the 32-bit or 64-bit environment has been set up, start the IBM WebSphere MQ classes for JMS application using the
command:
java application-name
where
application-name is the name of the
IBM WebSphere MQ classes for JMS application to be run.
An
exception containing
IBM WebSphere MQ Reason Code 2495
(MQRC_MODULE_NOT_FOUND) is thrown by the
IBM WebSphere MQ
classes for JMS if:
- The IBM WebSphere MQ classes for JMS application is
run in a 32-bit Java runtime environment, and a 64-bit environment has been set up for the IBM WebSphere MQ classes for JMS, as the 32-bit Java runtime
environment is unable to load the 64-bit Java Native Library.
- The IBM WebSphere MQ classes for JMS application is
run in a 64-bit Java runtime environment, and a 32-bit environment has been set up for the IBM WebSphere MQ classes for JMS, as the 64-bit Java runtime
environment is unable to load the 32-bit Java Native Library.