Series
This is the second post in a series on using Oracle Middleware with IBM MQ Series. In this series, the following articles are available:
- IBM MQ Series Installation and Configuration
- Configuration of JMS and MQ Adapters in WebLogic
- Use case: JMS Adapter and MQ
- Use case: MQ Adapter
- Use case: MQ Transport
JMS and MQ Adapter
The use cases we implement will use the (native) MQ Adapter and the JMS adapter with MQ as a data source.
This section covers the configuration of the adapters. Oracle documented this in:
http://docs.oracle.com/middleware/1221/adapters/develop-soa-adapters/GUID-2F26D2ED-BAE0-4009-9AE9-5A5889171C25.htm#TKADP-GUID-6BE2332C-5BE3-4CD8-89E4-DDC6386F20BF
Also, a use case with MQ transport is given. The only one that is missing is the one with JMS transport. Guess you can’t have it all…
1. JMS Adapter
First of all, let me refer you to a document on Oracle Support (support.oracle.com). It’s titled ‘How to Configure Oracle JMS Adapter with IBM WebSphere MQ JMS with Examples for Global (XA) Transactions (Doc ID 1349263.1)’. It is based on SOA Suite 11.1.1.4 and IBM WebSphere MQ V7.x. It is still valid and a must-read!
The JMS Adapter is configured in a number of steps.
1.1 Adding MQ jar files
Some MQ jar files need to be added to the SOA Suite installation.
The MQ jar files can be found in: /<YOUR-MQSERIES-INSTALL-LOCATION>/java/lib/
They must be copied to: <SOAInstall_DIR>/user_projects/domains/<DOMAIN_NAME>/lib.
In our case (as user developer):
[developer@localhost lib]$ pwd<br>/home/developer/Oracle/Middleware/Oracle_Home/user_projects/domains/base_domain/lib<br>[developer@localhost lib]$ cp /opt/mqm/java/lib/com.ibm.mq.jar .<br>[developer@localhost lib]$ cp /opt/mqm/java/lib/com.ibm.mqjms.jar .<br>[developer@localhost lib]$ cp /opt/mqm/java/lib/dhbcore.jar .<br>[developer@localhost lib]$ ls<br>com.ibm.mq.jar com.ibm.mqjms.jar dhbcore.jar readme.txt<br>[developer@localhost lib]$
Note that the above files are sufficient for both XA and non-XA data sources. If your MQ version is prior to 7.5, you also need to copy the file com.ibm.mqetclient.jar.
MQ transport error
In your server log, you may find the error below:
IBM MQ Transport eorror:<br><Jan 1, 2016 5:20:15 PM EST> <Error> <Deployer> <BEA-149205> <Failed to initialize the application "Service Bus MQ Transport Provider" due to error java.lang.ClassNotFoundException: com.ibm.mq.jmqi.JmqiObject<br>java.lang.ClassNotFoundException: com.ibm.mq.jmqi.JmqiObject<br> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)<br> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)<br> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)<br> at java.lang.ClassLoader.defineClass1(Native Method)<br> at java.lang.ClassLoader.defineClass(ClassLoader.java:760)<br> Truncated. see log file for complete stacktrace<br>Caused By: java.lang.ClassNotFoundException: com.ibm.mq.jmqi.JmqiObject<br> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)<br> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)<br> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)<br> at java.lang.ClassLoader.defineClass1(Native Method)<br> at java.lang.ClassLoader.defineClass(ClassLoader.java:760)<br> Truncated. see log file for complete stacktrace<br>>
This indicates a missing file class com.ibm.mq.jmqi.JmqiObject that can be found in the jar file com.ibm.mq.jmqi.jar.
Therefore I copied the jar to the demain/lib directory:
[developer@localhost lib]$ pwd<br>/home/developer/Oracle/Middleware/Oracle_Home/user_projects/domains/base_domain/lib<br>[developer@localhost lib]$ cp /opt/mqm/java/lib/com.ibm.mq.jmqi.jar .<br>[developer@localhost lib]$
This is also Also described in support doc id:
ClassNotFoundException/NoClassDefFoundError for com/ibm/mq/jmqi/system/JmqiComponent Using JMS Adapter with MQ 7.x Client Libraries (Doc ID 1346760.1)
1.2 Start MQ QueueManager and SOA Suite
Both SOA Suite and QueueManager QM_AMIS can be started now:
<br>[developer@localhost ~]$ cd Oracle/Middleware/Oracle_Home/user_projects/domains/base_domain/<br>[developer@localhost base_domain]$ ./startWebLogic.sh
and
[developer@localhost ~]$ strmqm QM_AMIS
1.3 Configure the JMS Adapter
Log in into the WebLogic Administration Console, in our case: http://localhost:7001/console/ and go to Deployments:
Scroll down and select the JMS Adapter
Select the Configuration tab and then the Outbound Connection Pools tab
Click the New button and in the ‘Outbound Connection Group’ select ‘oracle.tip.adapter.jms.IJmsConnectionFactory’:
Click the Next button, and give the JNDI Name eis/jms/AMIS
Click the Finish button
Click OK to save the Deployment Plan.
Now, you’re back in the JMS Adapter screen, where you select the Configuration tab again and the plus sign for the ‘oracle.tip.adapter.jms.IJmsConnectionFactory’:
Now click on eis/jms/AMIS and fill in the Property Values as below:
QueueManager=QM_AMIS;TransportType=1;HostName=127.0.0.1;Port=1414;Channel=S_AMIS;ThirdPartyJMSProvider=true
Click on the Save button, goto Deployments and check the box left to the JMS adapter
Click the Update button (at beginning of list of deployments) and the select the option ‘Redeploy this application using the following deployment files’.
Click on Next and then on Finish
Now, the JMS adapter can use the queues under QueueManager QM_AMIS.
1.4 Notes
The configuration above is for handling messages on queues without transaction control. That is determined by the connection factory that is configured in the JMS adapter. Possibilities here are:
- com.ibm.mq.jms.MQTopicConnectionFactory -> Use when connecting to a non-XA Topic
- com.ibm.mq.jms.MQXATopicConnectionFactory -> Use when connecting to an XA Topic
- com.ibm.mq.jms.MQQueueConnectionFactory -> Use when connecting to a non-XA Queue
- com.ibm.mq.jms.MQXAQueueConnectionFactory -> Use when connecting to a XA Queue
For a better understanding of the factory properties, just google for the class name (e.g. com.ibm.mq.jms.MQQueueConnectionFactory). That brings you to a page like https://www-01.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.javadoc.doc/WMQJMSClasses/com/ibm/mq/jms/MQQueueConnectionFactory.html, where you can find more details.
Be careful on the jar files that need to be copied:
- they are different for the various MQ Versions
- don’t forget to copy the missing jar file com.ibm.mq.jmqi.jar
In our example, we didn’t work with channel authentication – so it was not necessary to configure it. It’s not difficult… 😉
2. MQ Adapter
The MQ Adapter is configured in a number of steps.
2.1 Adding MQ jar files
For version 7.5 of IBM MQ Series, Oracle documentation shows that the following jars are required:
- com.ibm.mq.commonservices.jar
- com.ibm.mq.jar
- com.ibm.mq.pcf.jar
- com.ibm.mq.headers.jar
- com.ibm.mq.jmqi.jar
Remember, that with our starting point, already some files are present.
[developer@localhost lib]$ ls<br>com.ibm.mq.jar com.ibm.mq.jmqi.jar com.ibm.mqjms.jar dhbcore.jar readme.txt<br>[developer@localhost lib]$ cp /opt/mqm/java/lib/com.ibm.mq.commonservices.jar .<br>[developer@localhost lib]$ cp /opt/mqm/java/lib/com.ibm.mq.pcf.jar .<br>[developer@localhost lib]$ cp /opt/mqm/java/lib/com.ibm.mq.headers.jar .<br>[developer@localhost lib]$ ls<br>com.ibm.mq.commonservices.jar com.ibm.mq.jar com.ibm.mqjms.jar dhbcore.jar<br>com.ibm.mq.headers.jar com.ibm.mq.jmqi.jar com.ibm.mq.pcf.jar readme.txt<br>[developer@localhost lib]$
2.2 MQ settings
Furthermore, Oracle recommends settings on the QueueManager:
- set the keep-alive setting
- set the “SharingConversation” property of the Server Connection Channel to zero
I did both in the MQ Explorer:
1. set the keep-alive setting
Goto the Properties of the QueueManager QM_AMIS
2. set the “SharingConversation” property of the Server Connection Channel to zero
First, start the QueueManager and then goto the properties of the Channel S_AMIS:
2.3 Configure the MQ Adapter
Now, the MQ Adapter can be configured.
Log in into the WebLogic Administration Console, in our case: http://localhost:7001/console/ and goto Deployments:
Scroll down and click on MQSeriesAdapter
Select the Configuration tab and then the Outbound Connection Pools tab
Click the New button and in the ‘Outbound Connection Group’ select ‘oracle.tip.adapter.jms.IJmsConnectionFactory’:
Click the Next button, and give the JNDI Name eis/MQ/AMIS
Click the Finish button
Change the name to MQ_AdapterPlan.xml and click OK to save the Deployment Plan.
Now, you’re back in the MQSeriesAdapter screen, where you select the Configuration tab again and the plus sign for the ‘oracle.tip.adapter.jms.IJmsConnectionFactory’:
Now click on eis/MQ/AMIS and fill in the Property Values as below:
Page 1:
Page 2:
Page 3:
Page 4:
Click on the Save button, goto Deployments and check the box left to the MQSeriesAdapter
Click the Update button (at beginning of list of deployments) and the select the option ‘Redeploy this application using the following deployment files’.
Click on Next and then on Finish
Now, the MQ adapter can use the queues under QueueManager QM_AMIS.
3. MQ transport for Service Bus
Next to the two JCA Adapters, the MQ transport will also be used.
3.1 Adding MQ jar files
For version 7.5 of IBM MQ Series, Oracle documentation shows that the following jars are required:
- com.ibm.mq.jar
However, when I tested with only that jar in the lib folder, (of course) lots of errors popped up. I ended with the following jar files:
[developer@localhost lib]$ pwd<br>/home/developer/Oracle/Middleware/Oracle_Home/user_projects/domains/base_domain/lib<br>[developer@localhost lib]$ ls -l <br>total 4300<br>-r--r--r--. 1 developer developer 783067 Jan 6 14:47 com.ibm.mq.commonservices.jar<br>-r--r--r--. 1 developer developer 271212 Jan 6 14:58 com.ibm.mq.headers.jar<br>-r--r--r--. 1 developer developer 431289 Jan 2 12:34 com.ibm.mq.jar<br>-r--r--r--. 1 developer developer 2808476 Jan 6 14:24 com.ibm.mq.jmqi.jar<br>-r--r--r--. 1 developer developer 91947 Jan 6 15:07 com.ibm.mq.pcf.jar<br>-rw-r-----. 1 developer developer 702 Dec 24 04:13 readme.txt<br>[developer@localhost lib]$
The is enough to get you going with the MQ transport for Service Bbus.