cancel
Showing results for 
Search instead for 
Did you mean: 

How to integrate Websphere MQ as an external JMS Provider?

Former Member
0 Kudos

Hello to all!

I'm trying to integrate Websphere MQ in SAP Web AS 6.40 as an external JMS provider and I'm having some problems. As the use of SAP XI is impossible for me, I started using the built-in JMS Connector.

I've already read (and tried to follow) the documentation in http://help.sap.com/saphelp_nw04/helpdata/en/cd/4d4941abbb4c0de10000000a1550b0/frameset.htm, but unfortunately, it didn't help me that much.

It told me that the JMS Connector is the right place to start, and I already managed to deploy and define the Websphere MQ JMS implementation as a library. And from various examples I'm quite sure that Websphere MQ is an JNDI based JMS provider. But now the problems start.

According to the SAP library mentioned above, I have to enter the JNDI name to the ConnectionFactory in the "New ConnectionFactory" dialogue in the "Provider" tab. As an example there is the (existing) JNDI name "jmsfactory/default/TopicConnection". For doing the same with my Websphere MQ, I expect to need something alike.

Hoping that I'm getting the SAP library right at this point, I'm expecting to need a JNDI entry, like, let's say, "jmsfactory/WebsphereMQ/QueueConnection" connected to the class "com.ibm.mq.jms.MQConnectionFactory" (MQConnectionFactory is the class in the MQ JMS implementation that implements the JMS interface "Connection Factory"). How can I put those Websphere MQ classes, that are implementing the JMS interfaces like Connection Factory, QueueConnectionFactory and so on

in my JNDI tree? The point is, obviously, no JNDI entry was made during deploying Websphere MQ as a library.

Or am I totally wrong an misunderstood the SAP library completely? Any help on this topic would be highly appreciated.

Best greetings!

Bärbel

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Integrating WebSphereMQ with SAP Web Application Server

Prerequisites

The native libraries of WebSphereMQ must be added to the environment variables of the host or hosts where the SAP Web AS is running. Typically, if MQ is installed on the same host, the required entries are added to the environment at installation. However, we recommend that you check the MQ documentation for details about the directory where the libraries are located, and make sure it is added to the environment on all hosts with SAP Web AS.

For example, for Windows OS the following libraries are required:

- amqmtmgr.dll

- amqvwaa2.dll

- amqxcs2.dll

- amqxcsn.dll

- amqzc.dll

- amqzsai.dll

- amqzst.dll

- amqztm.dll

- mqjbdf02.dll

- mqjbnd05.dll

- mqm.dll

- mqmvxd.dll

- mqmxa.dll

- MQXAi02.dll

Procedure

1) If the version of the SAP Web AS is SP 7 or lower, you must apply a patch for the JMS Connector Service. The required SDA is attached to this e-mail (jmsconnector.sda). To apply it:

a. Run the SDM Remote GUI tool. It is located in <SAP_install_dir>\SAPSID\<Instance_ID>\SDM\program.

b. In the Deployment tab, add the jmsconnector.sda to the deployment list. Choose Show Deployment Configuration. Select Update deployed SDAs/SCAs that have any version (this ensures that you will have the SDA deployed even if for some reason its timestamp is older than the one of the SP7 SDA that you already have deployed.)

c. Deploy the SDA following the standard deployment procedure. If prompted to choose if you want to delegate the control to the SDM server, choose Yes. The SDM shuts down the cluster, deploys the SDA, and then restarts the cluster.

2) Create the IBM MQ library. You can do it using either Visual Administrator or SAP NetWeaver Developer Studio.

a. Visual Administrator:

i. Go to Services -> JMS Connector.

ii. Select JMS Libraries, and choose New.

iii. Enter a name for the library, such as MQJMSLIB.

iv. Browse to select the following JAR files:

- com.ibm.mq.jar

- com.ibm.mqbind.jar

- com.ibm.mqjms.jar

- fscontext.jar

- ldap.jar

- postcard.jar

- provider.xml

- providerutil.jar

v. Deploy the library.

vi. Go to Services -> Configuration Adapter. In the configuration tree on the right-hand side of the screen browse to cluster_data -> server -> cfg -> ext -> MQJMSLIB-provider.xml. Switch to edit mode using . Open the XML for editing using . Add the following entry (after the reference entry for jms):

<reference type="library" strength="weak">j2eeca</reference>

Choose OK and restart the cluster to apply the changes.

b. SAP NetWeaver Developer Studio:

i. Create a J2EE Library project.

ii. Select the project and choose File -> Import -> File System. Browse to the MQ folder, which contains the JAR files listed above, and select to import them.

iii. Extend the tree of your library project and open server/provider.xml. Go to the Jars tab.

iv. Select Jars, and choose Add. Choose to add the JAR files that you have imported in the previous step.

v. Go to the References tab. Select References, and choose Add. Choose Select library/interface/service. In the list select jms and j2eeca.

vi. Save and close provider.xml. From the context menu of the library project choose Build Library Archive.

vii. Select the SDA in the project tree, open its context menu, and choose Deploy to J2EE Engine.

3) Create a JMS Connector Factory in Visual Administrator.

You can either enter the required values directly in the Visual Administrator (Services -> JMS Connector), or you can edit the following sample deployment descriptors and import them in Visual Administrator using .

a. Using JNDI:

This is example of factories.xml using JNDI based JMS provider.

<?xml version="1.0" encoding="UTF-8" ?>

<jms-factories>

<application-name>

IBM_Test_App

</application-name>

<connection-factory>

<library-name>

MQJMSLIB

</library-name>

<factory-name>

IBM_Queue_Factory

</factory-name>

<context-factory-type>

<!—This factory should already exist on WebSphereMQ.-->

<link-factory-name>

QCF_1

</link-factory-name>

<initial-context-factory>

com.sun.jndi.fscontext.RefFSContextFactory

</initial-context-factory>

<provider-url>

file:/C:/JNDI-Directory

</provider-url>

<security-principal>

</security-principal>

<security-credentials>

</security-credentials>

</context-factory-type>

</connection-factory>

</jms-factories>

b. Using object factory JMS provider

<?xml version="1.0" encoding="UTF-8" ?>

<jms-factories>

<application-name>

IBM_Test_App

</application-name>

<connection-factory>

<library-name>

MQJMSLIB

</library-name>

<factory-name>

IBM_Queue_Factory

</factory-name>

<object-factory-type>

<object-factory-name>

com.ibm.mq.jms.MQXAQueueConnectionFactoryFactory

</object-factory-name>

<class-name>

com.ibm.mq.jms.MQXAQueueConnectionFactory

</class-name>

<properties>

<property>

<property-name>

HOST

</property-name>

<!-- JMS Provider host name -->

<property-value>

localhost

</property-value>

</property>

<property>

<property-name>

QMGR

</property-name>

<!-- Queue Manager -->

<property-value>

MQ_default

</property-value>

</property>

<property>

<property-name>

PORT

</property-name>

<!-- JMS Provider port number -->

<property-value>

1414

</property-value>

</property>

<property>

<property-name>

TRAN

</property-name>

<!-- Transport type -->

<property-value>

1

</property-value>

</property>

</properties>

</object-factory-type>

</connection-factory>

</jms-factories>

4) Use the connection factory in an application:

Code:

Context ctx = new InitialContext();

Object ref = ctx.lookup("java:comp/env/IBM_Queue_Factory");

QueueConnectionFactory f = (QueueConnectionFactory)ref;

QueueConnection connection = f.createQueueConnection();

Resource references:

<resource-ref>

<res-ref-name>

IBM_Queue_Factory

</res-ref-name>

<res-type>

javax.jms.QueueConnectionFactory

</res-type>

<res-auth>

Container

</res-auth>

</resource-ref>

If you are using 6.40 SP7 or below let me know to send you a patch.

Regards Nikola

Former Member
0 Kudos

Dear Nicola,

Thank you very, very much for your help! And thank you for your offer to send me the needed SAP Web AS 6.40 patch.

In the moment, I'm already using 6.40 SP 9, although for the time of patching, I didn't know anything about a SDM Remote GUI tool. So I had to go the more stony way there. Thank you for your advice here, too. Now I know a more comfortable way of applying a patch.

You really helped me a lot. I was on the totally wrong way. As the import of a jms-factory.xml using Websphere MQ as a JNDI based provider went wrong with a NamingException each time (obviously there are problems with QCF_1 as the link factory), using the object factory option seemed to be the right way.

Now, with Websphere MQ as a object based connection factory, this connection factory appeared in my JNDI registry, too, and I was able to continue. The "hen and egg problem" that I had with the JNDI entries is solved.

Best Greetings from Munich!

Bärbel

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

does anyone have expierence with integrating MQ on AIX platform ? What are the native libraries there ?

Kind Regards,

Max