Support for OSGi with IBM MQ classes for Java
OSGi provides a framework that supports the deployment of applications as bundles. Three OSGi bundles are supplied as part of the IBM® MQ classes for Java.
OSGi provides a general purpose, secure, and managed Java framework, which supports the deployment of applications that come in the form of bundles. OSGi-compliant devices can download and install bundles, and remove them when they are no longer required. The framework manages the installation and updating of bundles in a dynamic and scalable fashion.
- com.ibm.mq.osgi.java_version_number.jar
- The JAR files to allow applications to use the IBM MQ classes for Java.
- com.ibm.mq.osgi.allclient_version_number.jar
- This JAR file allows applications to use both the IBM MQ classes for JMS and the IBM MQ classes for Java, and also includes the code to handle PCF messages.
- com.ibm.mq.osgi.allclientprereqs_version_number.jar
- This JAR file provides the prerequisites for com.ibm.mq.osgi.allclient_version_number.jar.
The bundles are installed into the java/lib/OSGi subdirectory of your IBM MQ installation, or the java\lib\OSGi folder on Windows.
From IBM MQ 8.0, use the bundles com.ibm.mq.osgi.allclient_8.0.0.0.jar, and com.ibm.mq.osgi.allclientprereqs_8.0.0.0.jar for any new applications. Using these bundles removes the restriction of not being able to run both IBM MQ classes for JMS and the IBM MQ classes for Java within the same OSGi framework. All other restrictions still apply however. For versions of IBM MQ before Version 8.0, the restriction of using either IBM MQ classes for JMS or IBM MQ classes for Java applies.
java.lang.ClassCastException: com.ibm.mq.MQException incompatible with com.ibm.mq.MQException
The OSGi bundle for the IBM MQ classes for Java has been written to the OSGi Release 4 specification; it does not work in an OSGi Release 3 environment.
You must set your system path or library path correctly so that the OSGi runtime environment can find any required DLL files or shared libraries.
If you use the OSGi bundle for the IBM MQ classes for Java, channel exit classes written in Java are not supported because of an inherent problem in loading classes in a multiple class loader environment such as OSGi. A user bundle can be aware of the IBM MQ classes for Java bundle, but the IBM MQ classes for Java bundle is not aware of any user bundle. As a result, the class loader used in an IBM MQ classes for Java bundle cannot load a channel exit class that is in a user bundle.
For more information about OSGi, see the OSGi alliance website.