Oracle Middleware and IBM MQ Series – Configuration of JMS and MQ Adapters in WebLogic main

Oracle Middleware and IBM MQ Series – Configuration of JMS and MQ Adapters in WebLogic

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:

  1. IBM MQ Series Installation and Configuration
  2. Configuration of JMS and MQ Adapters in WebLogic
  3. Use case: JMS Adapter and MQ
  4. Use case: MQ Adapter
  5. 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&nbsp; com.ibm.mqjms.jar&nbsp; dhbcore.jar&nbsp; 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>&lt;Jan 1, 2016 5:20:15 PM EST&gt; &lt;Error&gt; &lt;Deployer&gt; &lt;BEA-149205&gt; &lt;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>&nbsp;&nbsp;&nbsp; at java.net.URLClassLoader.findClass(URLClassLoader.java:381)<br>&nbsp;&nbsp;&nbsp; at java.lang.ClassLoader.loadClass(ClassLoader.java:424)<br>&nbsp;&nbsp;&nbsp; at java.lang.ClassLoader.loadClass(ClassLoader.java:357)<br>&nbsp;&nbsp;&nbsp; at java.lang.ClassLoader.defineClass1(Native Method)<br>&nbsp;&nbsp;&nbsp; at java.lang.ClassLoader.defineClass(ClassLoader.java:760)<br>&nbsp;&nbsp;&nbsp; Truncated. see log file for complete stacktrace<br>Caused By: java.lang.ClassNotFoundException: com.ibm.mq.jmqi.JmqiObject<br>&nbsp;&nbsp;&nbsp; at java.net.URLClassLoader.findClass(URLClassLoader.java:381)<br>&nbsp;&nbsp;&nbsp; at java.lang.ClassLoader.loadClass(ClassLoader.java:424)<br>&nbsp;&nbsp;&nbsp; at java.lang.ClassLoader.loadClass(ClassLoader.java:357)<br>&nbsp;&nbsp;&nbsp; at java.lang.ClassLoader.defineClass1(Native Method)<br>&nbsp;&nbsp;&nbsp; at java.lang.ClassLoader.defineClass(ClassLoader.java:760)<br>&nbsp;&nbsp;&nbsp; Truncated. see log file for complete stacktrace<br>&gt; 

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:

mq_004_weblogic_admin_console

 

Scroll down and select the JMS Adapter

mq_005_jms_adapter

Select the Configuration tab and then the Outbound Connection Pools  tab

mq_006_jms_adapter_outb_conn

 

Click the New button and in the ‘Outbound Connection Group’ select ‘oracle.tip.adapter.jms.IJmsConnectionFactory’:

mq_007_jms_adapter_outb_conn_conn_fac

 

Click the Next button, and give the JNDI Name eis/jms/AMIS

mq_008_jms_adapter_outb_conn_conn_fac_jndi

 

Click the Finish button

mq_009_jms_adapter_outb_conn_conn_fac_dep_plan

 

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’:

mq_010_jms_adapter_outb_conn

 

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

mq_011_jms_adapter_outb_conn_properties

 

Click on the Save button, goto Deployments and check the box left to the JMS adapter

mq_012_jms_adapter_for_restart

 

Click the Update button (at beginning of list of deployments) and the select the option ‘Redeploy this application using the following deployment files’.

mq_013_jms_adapter_deployment_plan

 

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&nbsp; com.ibm.mq.jmqi.jar&nbsp; com.ibm.mqjms.jar&nbsp; dhbcore.jar&nbsp; 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&nbsp; com.ibm.mq.jar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; com.ibm.mqjms.jar&nbsp;&nbsp; dhbcore.jar<br>com.ibm.mq.headers.jar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; com.ibm.mq.jmqi.jar&nbsp; com.ibm.mq.pcf.jar&nbsp; readme.txt<br>[developer@localhost lib]$ 

 

2.2 MQ settings

 

Furthermore, Oracle recommends settings on the QueueManager:

  1. set the keep-alive setting
  2. 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

mq_201_mq_settings_keep_alive

 

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:

 

mq_202_mq_settings_sharing_conversations

 

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:

mq_203_weblogic_admin_console

 

Scroll down and click on MQSeriesAdapter

mq_204_mq_adapter

 

Select the Configuration tab and then the Outbound Connection Pools  tab

mq_205_mq_adapter_outb_conn

 

Click the New button and in the ‘Outbound Connection Group’ select ‘oracle.tip.adapter.jms.IJmsConnectionFactory’:

mq_206_mq_adapter_outb_conn_conn_fac

 

Click the Next button, and give the JNDI Name eis/MQ/AMIS

mq_208_mq_adapter_outb_conn_conn_fac_jndi

 

Click the Finish button

mq_208_mq_adapter_outb_conn_conn_fac_jndi

 

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’:

mq_209_mq_adapter_outb_conn

 

Now click on eis/MQ/AMIS and fill in the Property Values as below:

Page 1:

mq_210_mq_adapter_outb_conn_properties_p1

 

Page 2:

mq_211_mq_adapter_outb_conn_properties_p2

 

Page 3:

mq_212_mq_adapter_outb_conn_properties_p3

 

Page 4:

mq_213_mq_adapter_outb_conn_properties_p4

 

Click on the Save button, goto Deployments and check the box left to the MQSeriesAdapter

mq_214_mq_adapter_for_restart

 

Click the Update button (at beginning of list of deployments) and the select the option ‘Redeploy this application using the following deployment files’.

mq_215_mq_adapter_deployment_plan

 

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&nbsp; 783067 Jan&nbsp; 6 14:47 com.ibm.mq.commonservices.jar<br>-r--r--r--. 1 developer developer&nbsp; 271212 Jan&nbsp; 6 14:58 com.ibm.mq.headers.jar<br>-r--r--r--. 1 developer developer&nbsp; 431289 Jan&nbsp; 2 12:34 com.ibm.mq.jar<br>-r--r--r--. 1 developer developer 2808476 Jan&nbsp; 6 14:24 com.ibm.mq.jmqi.jar<br>-r--r--r--. 1 developer developer&nbsp;&nbsp; 91947 Jan&nbsp; 6 15:07 com.ibm.mq.pcf.jar<br>-rw-r-----. 1 developer developer&nbsp;&nbsp;&nbsp;&nbsp; 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.