Integrate weblogic with websphere MQ

ibm websphere

1. Download Websphere MQ from the following location and install it.
2. Run the following command to create the necessary resources in MQ:

Change directory to MQ_HOME/bin folder:
– Create a MQ manager (Example: “MQM”):

	crtmqm MQM

– Start the MQ Manager:

	strmqm MQM

– Create local queue and channel:

	runmqsm
	DEFINE QLOCAL('DAVE') DEFPSIST(YES) //{Example: DAVE is the queuename}
	DEFINE CHANNEL(MAP.SVRCONN) CONNAME(SVRCONN) XMITQ(WW) //{Example: MAP.SVRCONN is the channel name}
	End

3. Include weblogic.jar in the classpath and also include JRE in the path.

4. Run the following command to start JMSAdmin:

JMSAdmin.bat -v -cfg MyAdmin.cfg  //Example: MyAdmin.cfg is the file name

Now JMSAdmin can be started. MyAdmin.config should have the following contents:

	Create :/JNDI-Directory
	INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
	PROVIDER_URL=file:/:/JNDI-Directory
	SECURITY_AUTHENTICATION=none


5. Create the QueueConnectionFactory and Queue objects by executing the command:

	C:\Program Files\IBM\WebSphere MQ\Java\bin\JMSAdmin.bat -cfg MyAdmin.config

You should see this prompt, where you can configure the JNDI objects: InitCtx>

At the prompt, type the following commands and press Enter after each one:

	def qcf(MQM.BUS.MEX) qmgr(MQM) CHANNEL(MAP.SVRCONN)    //{Example:MQM.BUS.MEX) is the queue Connection Factory name}
	def q(MQM.BUS.INX) qmgr(MQM) queue(DAVE)   //{Example: MQM.BUS.INX is the queue name}
	end

6. When WLS and MQ are installed on different machines, we need to install MQ transactional client to successfully integrate WLS with MQ.

Install MQ transactional client and then run MQ’s JMSAdmin utility (Step 5) to bind MQ destination with a JNDI name.
7. Copy the following libraries in $domain_home/lib folder:
– com.ibm.mq.jar
– com.ibm.mqjms.jar
– com.ibm.mqetclient.jar
– fscontext.jar
– dhbcore.jar

8. Start weblogic server

9. Create Foreign JMS Server, JMS Module, subdeployment, Queueconnection factory and Foreign Destination

10. Access http://apphostnbame:7001 /console, authenticating with the user name and password used in creating the WebLogic server instance above. After login, navigate to domain => Services => JMS => Foreign JMS Servers. In the right pane, click Configure a new Foreign JMSServer and enter the following values:

Name: MQJMSTEST Foreign JMS Server
JNDI Initial Context Factory: com.sun.jndi.fscontext.RefFSContextFactory
JNDI Connection URL: file:/C:/JNDI-Directory

11. Navigate to MQJMSTEST => Services => JMS => Foreign JMS Servers => MQJMSTEST Foreign JMS Server => Foreign JMS Connection Factories. In the right pane, click Configure a new Foreign JMSConnection Factory and enter the following values:
Name: MQM.BUS.MEX
Local JNDI Name: jms/MQM.BUS.MEX
Remote JNDI Name: MQM.BUS.MEX
The remote JNDI Name should match the QueueConnectionFactory name created in the file-based JNDI using the JMSAdmin tool.

12. To create the destinations, navigate to MQJMSTEST => Services => JMS => Foreign JMS Servers => MQJMSTEST Foreign JMS Server => Foreign JMS Destinations. In the right pane, click Configure a new foreign JMSDestination and enter the following values:

Name: MQM.BUS.INX
Local JNDI Name: jms/MQM.BUS.INX
Remote JNDI Name: MQM.BUS.INX
The remote JNDI Name should match the destinations created in the file-based JNDI using the JMSAdmin tool.

13. For sending a message to MQ, we need to use “Run listener command”:

runmqlsr -t tcp -p 1414 -m MQM

In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.

3 Responses

  1. Navneet says:

    Hi,

    Thanks for sharing the information!
    after did all the changes i need to do test. can you shared us some WLS application or suggest me.
    I am stuck on testing with WL and MQ.

    Please help me.

    Thanks,
    Navneet

  2. Parameswara.rao says:

    Hi,

    Currently we are using weblogic 12.1.3 and am planning to used MQ for messaging.
    Can you share the WebSphere MQ compatibility details for weblogic 12.1.3 ?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.