What we need:
You must have following software installed in your system:
- WebSphere MQ 6
- BEA Weblogic 10
- JDK 1.5 or above. (This comes bundled with Weblogic)
What we going to do:
- Create a queue manager and two local queues namely MQSenderQueue and MQReceiverQueue in Websphere MQ, one for sending a message to our MDB at Weblogic and other one for receiving messages from Weblogic. Create and configure JMS Foreign Server, Destinations and Connection Factories.
- Code and deploy a MDB in Weblogic and automatically receive messages from MQ MQSenderQueue and place it at a second MQ queue MQReceiverQueue using Weblogic Foreign JSM Server features.
For testing:
Creating queue managers, queues and connection factories in WebSphere MQ:- Put a test message to MQSenderQueue at MQ.
- Monitor Weblogic console to see if it has received and sent the message again to MQ.
- See the message received at the MQReceiverQueue at MQ.
Creating queue manage

Image #1: WebSphere MQ Explorer
Click on Start -> Program Files -> IBM WebSphere MQ -> WebSphere MQ Explorer to open WebSphere MQ Explorer. Optionally execute C:\Program Files\ibm\WebSphere MQ\bin strmqcfg.exe to run explorer.

Image #1: WebSphere MQ Explorer
On the left hand side WebSphere MQ Explorer – Navigator pane, click on 'IBM WebSphere MQ' node to expand that, if it is not expanded already.
- To create a queue manager, right click on the ‘Queue Managers’ node and select New -> Queue Manager.
- In the opened window, enter name “MQTest” in the name textbox and keep clicking Next-> and finally click Finish.
Creating WebSphere MQ local queues
Creating JNDI Context and Connection factories
Now let us create MQ queues. As I mentioned above, we are going to create two queues. We will be using one of them to put a test message which is to be received by our MDB at BEA Weblogic and the other one is used by our MDB to put message the message back into second MQ queue, so that we can see the same message again in MQ, but in the second MQ queue.
We are going to create two local queues using MQ explorer.
1. To create our first local MQ queue, right click on Queues node under “MQTest” queue manager. Select New -> Local Queue.
3. Repeat the above two steps to create another local queue “MQReceiverQueue”. Note the naming I followed here – used a prefix MQ to avoid the confusions since we use similar JNDI names in Weblogic also.
Optionally, you may create MQ queue manager and local queues using command prompt. Open a command prompt (CMD) and CD to C:\Program Files\ibm\WebSphere MQ\bin.
We are going to create two local queues using MQ explorer.
1. To create our first local MQ queue, right click on Queues node under “MQTest” queue manager. Select New -> Local Queue.
Image #5: Create local queue in MQ
2. Enter name for our first local MQ queue “MQSenderQueue” as shown below. Click “Next” and finally “Finish”. This is the queue we will be using to put our test message.Image #6: Create local queue in MQ
3. Repeat the above two steps to create another local queue “MQReceiverQueue”. Note the naming I followed here – used a prefix MQ to avoid the confusions since we use similar JNDI names in Weblogic also.
Optionally, you may create MQ queue manager and local queues using command prompt. Open a command prompt (CMD) and CD to C:\Program Files\ibm\WebSphere MQ\bin.
- Create the queue manager: crtmqm MQTest.
- Start the queue manager: strmqm MQTest.
- Create queues in the queue manager:
runmqsc MQTestPlease note that I haven’t tried this option, so I am not sure how it works.
DEFINE QLOCAL(MQSenderQueue)
DEFINE QLOCAL(MQReceiverQueue)
end
Creating JNDI Context and Connection factories
Next, create a simple file-based JNDI context and configure the JMS objects in that JNDI namespace. These JNDI objects are used by applications running in WebSphere Application Server Community Edition to connect to the WebSphere MQ queue manager. For this exercise, WebLogic and WebSphere MQ should be on the same machine.
The setting is for file-based JNDI. Create the directory C:\MQ-JNDI before continuing with the next step. Under new folder C:\MQ-JNDI, create a file mq-jndi.properties with the following contents:
INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
PROVIDER_URL=file:/C:/MQ-JNDI
SECURITY_AUTHENTICATION=none
Next open a command prompt, cd to C:\MQ-JNDI, create the QueueConnectionFactory and Queue objects by executing the command:
“C:\Program Files\IBM\WebSphere MQ\Java\bin\JMSAdmin.bat” -cfg mq-jndi.properties
You should see this prompt, where you can configure the JNDI objects:
InitCtx>
At the prompt, copy and paste all five lines of following commands together and press Enter.
You should see a message like “Stopping Websphere MQ classes for Java(tm) Message Service Administration” after you press Enter after the last line “end”.
With that, we now have MQ queues ready (see following image). Next task is to create a MDB in EJB 3 and deploy it in BEA Weblogic 10.
The setting is for file-based JNDI. Create the directory C:\MQ-JNDI before continuing with the next step. Under new folder C:\MQ-JNDI, create a file mq-jndi.properties with the following contents:
INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
PROVIDER_URL=file:/C:/MQ-JNDI
SECURITY_AUTHENTICATION=none
Next open a command prompt, cd to C:\MQ-JNDI, create the QueueConnectionFactory and Queue objects by executing the command:
“C:\Program Files\IBM\WebSphere MQ\Java\bin\JMSAdmin.bat” -cfg mq-jndi.properties
You should see this prompt, where you can configure the JNDI objects:
InitCtx>
At the prompt, copy and paste all five lines of following commands together and press Enter.
def xaqcf(MQSenderQCF) qmgr(MQTest)
def xaqcf(MQReceiverQCF) qmgr(MQTest)
def q(MQSenderQueue) qmgr(MQTest) queue(MQSenderQueue)
def q(MQReceiverQueue) qmgr(MQTest) queue(MQReceiverQueue)
end
def xaqcf(MQReceiverQCF) qmgr(MQTest)
def q(MQSenderQueue) qmgr(MQTest) queue(MQSenderQueue)
def q(MQReceiverQueue) qmgr(MQTest) queue(MQReceiverQueue)
end
You should see a message like “Stopping Websphere MQ classes for Java(tm) Message Service Administration” after you press Enter after the last line “end”.
With that, we now have MQ queues ready (see following image). Next task is to create a MDB in EJB 3 and deploy it in BEA Weblogic 10.
Image #7: MQ explorer showing queue manager and local queues.
Configuring Foreign JSM Server in BEA Weblogic Server:
Before starting your Weblogic Server you have to ensure that certain MQ related jar files are in your Weblogic Server’s classpath. Easiest way to do this is to copy following jars from “C:\Program Files\ibm\WebSphere MQ\Java\lib” folder to your Weblogic domain’s lib (C:\bea\user_projects\domains\RnD\lib in my case) folder, from where Weblogic loads them up while starting.
- com.ibm.mq.jar
- com.ibm.mqjms.jar
- commonservices.jar
- dhbcore.jar
- fscontext.jar
Once jars are in Weblogic Server’s class path, start your Weblogic server and login to Weblogic admin console. To start with, click ‘Lock & Edit’ button.
Expand Services -> Messaging on LHS menu and click JMS Modules link.
Click on “New” button on RHS
Type in a name “MQIntegrationTest” in the Name text box and press Next.
Expand Services -> Messaging on LHS menu and click JMS Modules link.
Click on “New” button on RHS
Image #8: Configuring JMS module
Type in a name “MQIntegrationTest” in the Name text box and press Next.
Image #9: Configuring JMS module
Select the Target server (in my case it was AdminServer) as shown below, press Next and finally Finish. Click on “Activate Changes” button on LHS.Image #10: Creating JMS module
Create JMS Foreign Server
Creating MDB and deploying it.Click on Lock & Edit again.
Select Services -> Messaging -> JMS Modules as you did earlier, and click on newly created module “MQIntegrationTest”. Click New button.
Select “Foreign Server” radio button and click “Next”.
Click Lock & Edit again.
Open the newly created Foreign JMS server byt clicking Services -> Messaging -> JMS Modules -> MQIntegrationTest -> MQTestForeignServer.
Under the General tab under Configuration, type in following details:
JNDI Initial Context Factory: com.sun.jndi.fscontext.RefFSContextFactory
JNDI Connection URL: file:/C:/MQ-JNDI
Click “Save”.
Click on Destinations link in the Configuration tab at the top and click New
Name: ReceiverDetails
Local JNDI Name: jms/WLReceiverQueue
Remote JNDI Name: MQSenderQueue
Note that the Remote JNDI Name must match the name of the queue you created in WebSphere MQ broker.
Click OK.
Name: ReplyDetails
Local JNDI Name: jms/WLReplyQueue
Remote JNDI Name: MQReceiverQueue
Now you can see two Destinations created:
Let’s create two Connection Factories for above queues.
Click on Connection Factories (next to Destinations) and click New
Enter following details in “Create a New Foreign JMS Connection Factory” page.
Name: ReceiverCF
Local JNDI Name: jms/WLReceiverQCF
Remote JNDI Name: MQSenderQCF
Again, the remote JNDI name must match on you have given to MQ connection factory.
Click Ok.
Name: ReplyCF
Local JNDI Name: jms/WLReplyQCF
Remote JNDI Name: MQReceiverQCF
With that, you can see two Connection Factories created for our Foreign JMS Server like shown below:
Select Services -> Messaging -> JMS Modules as you did earlier, and click on newly created module “MQIntegrationTest”. Click New button.
Select “Foreign Server” radio button and click “Next”.
Image #11: Creating JMS foreign server
Enter “MQTestForeignServer” in the Name text box, click Next button. In this page you can see that the target server is selected already. Click Finish.Image #12: Creating JMS foreign server
Image #13: Creating JMS foreign server
Activate changes by clicking “Activate Changes” button.Click Lock & Edit again.
Open the newly created Foreign JMS server byt clicking Services -> Messaging -> JMS Modules -> MQIntegrationTest -> MQTestForeignServer.
Under the General tab under Configuration, type in following details:
JNDI Initial Context Factory: com.sun.jndi.fscontext.RefFSContextFactory
JNDI Connection URL: file:/C:/MQ-JNDI
Click “Save”.
Image #14: Configure JMS foreign server
Creating DestinationsClick on Destinations link in the Configuration tab at the top and click New
Image #15: Create Destinations
Type in following:Name: ReceiverDetails
Local JNDI Name: jms/WLReceiverQueue
Remote JNDI Name: MQSenderQueue
Note that the Remote JNDI Name must match the name of the queue you created in WebSphere MQ broker.
Click OK.
Image #16: Configure Destination
Repeat the above to create another Destination with following details:Name: ReplyDetails
Local JNDI Name: jms/WLReplyQueue
Remote JNDI Name: MQReceiverQueue
Now you can see two Destinations created:
Image #17: Newly created Destinations
Creating DestinationsLet’s create two Connection Factories for above queues.
Click on Connection Factories (next to Destinations) and click New
Image #18: Create connection factories
Enter following details in “Create a New Foreign JMS Connection Factory” page.
Name: ReceiverCF
Local JNDI Name: jms/WLReceiverQCF
Remote JNDI Name: MQSenderQCF
Again, the remote JNDI name must match on you have given to MQ connection factory.
Click Ok.
Image #19: Create connection factory
Repeat the above steps to create one more connection factory for our ReplyQueue:Name: ReplyCF
Local JNDI Name: jms/WLReplyQCF
Remote JNDI Name: MQReceiverQCF
With that, you can see two Connection Factories created for our Foreign JMS Server like shown below:
Image #20: Connection factories
Click on “Activate Changes” to activate changes. With that you are done with creating and configuring Foreign JMS Server. The only thing pending before we test is to code and deploy our MDB.Here is the MDB code:
/*
* File: TestMDB.java
* Copyright (c) 2007-2008 ibswings.com. All rights reserved.
*/
package com.ibswings.ejb3.mdb;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.QueueConnection;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
/**
* Class: TestMDB
*
* @author Ishwara Varnasi
* @date Feb 17, 2008
*/
@MessageDriven(name = "TestMDB", mappedName = "jms/WLReceiverQueue",
activationConfig = {@ActivationConfigProperty(
propertyName = "destinationType",
propertyValue = "javax.jms.Queue")}
)
public class TestMDB implements MessageListener {
public void onMessage(Message msg) {
System.out.println("\n=========================================");
System.out.println("=> Message received!");
if (msg instanceof TextMessage) {
try {
System.out.println("=> Message: "
+ ((TextMessage) msg).getText());
} catch (JMSException e) {
e.printStackTrace();
}
}
// Place the message on to the reply queue (WLReplyQueue)
putMessage(msg);
System.out.println("=========================================");
}
@Resource(name = "WLReplyQueue", mappedName = "jms/WLReplyQueue")
private javax.jms.Queue queue;
@Resource(name = "WLReplyQCF", mappedName = "jms/WLReplyQCF")
private javax.jms.QueueConnectionFactory tcf;
public void putMessage(javax.jms.Message msg) {
System.out.println("=> Placing message on WLReplyQueue...");
QueueConnection queueConnection = null;
QueueSession queueSession = null;
QueueSender queueSender = null;
try {
queueConnection = tcf.createQueueConnection();
queueSession = queueConnection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
queueSender = queueSession.createSender(queue);
queueSender.send(msg);
System.out.println("=> Message sent!");
} catch (Exception e) {
System.out.println("Exception: ");
e.printStackTrace();
if (e instanceof JMSException) {
((JMSException) e).getLinkedException().printStackTrace();
}
} finally {
try {
System.out.println("=> Closing Connection");
queueSession.close();
queueConnection.close();
} catch (Exception e) {
System.out.println("Exception: ");
e.printStackTrace();
if (e instanceof JMSException) {
((JMSException) e).getLinkedException().printStackTrace();
}
}
}
}
@PostConstruct
public void postCreate() {
System.out.println("Bean Created");
}
@PreDestroy
public void preDestroy() {
System.out.println("Bean Destroyed");
}
}The above code is for a simple message driven bean. It receives messages from MQSenderQueue and onMessage() prints out the content of text message received. Next it places the message back to the WLReplyQue. Note that in the code we never directly place message on to MQ queue. We are actually placing the message to a MQ queue namely MQReceiverQueue using Foreign JMS Server and local Weblogic JNDI name WLReplyQue.
Since we are using EJB 3, we actually do not need an ejb-jar.xml since we are using annotaions. However, to make it work on Weblogic 10, we still need a weblogic-ejb-jar.xml. Somehow I couldn’t get it working without this. Also note that I am using an older (90) schema for weblogic-ejb-jar.xml. Following is the content of Weblogic-ejb-jar.xml:
Since we are using EJB 3, we actually do not need an ejb-jar.xml since we are using annotaions. However, to make it work on Weblogic 10, we still need a weblogic-ejb-jar.xml. Somehow I couldn’t get it working without this. Also note that I am using an older (90) schema for weblogic-ejb-jar.xml. Following is the content of Weblogic-ejb-jar.xml:
<weblogic-ejb-jar xmlns="http://www.bea.com/ns/weblogic/90"
j2ee="http://java.sun.com/xml/ns/j2ee"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemalocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd">
<weblogic-enterprise-bean>
<ejb-name>TestMDB</ejb-name>
<message-driven-descriptor>
<destination-jndi-name>
jms/WLReceiverQueue
</destination-jndi-name>
<connection-factory-jndi-name>
jms/WLReceiverQCF
</connection-factory-jndi-name>
</message-driven-descriptor>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
j2ee="http://java.sun.com/xml/ns/j2ee"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemalocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd">
<weblogic-enterprise-bean>
<ejb-name>TestMDB</ejb-name>
<message-driven-descriptor>
<destination-jndi-name>
jms/WLReceiverQueue
</destination-jndi-name>
<connection-factory-jndi-name>
jms/WLReceiverQCF
</connection-factory-jndi-name>
</message-driven-descriptor>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
Create EJB jar and deploy it in Weblogic Server. You need to restart Weblogic instance if you do any changes in MQ to reflect that in Weblogic. We are all set to test now!
Testing
Open WebSphere MQ explorer, click on MQTest (our queue manager) -> Queues. On the RHS table, right click on MQSenderQueue and select “Put test message” in the popup menu. Type in a test message, say, “Hello MQ-Weblogic World!”, click “Put Message” and close.
=========================================
=> Message received!
=> Message: Hello MQ-Weblogic World!
=> Placing message on WLReplyQueue...
=> Message sent!
=> Closing Connection
=========================================
Now go to MQ explorer and check messages in the second queue – MQReceiverQueue – you should be able to see this message.
This article is inspired by an article by Sanjay M Kesavan at
http://www-128.ibm.com/developerworks/websphere/library/techarticles/0604_kesavan/0604_kesavan.html
I would like thank Mr. Kesavan, author of above wonderful article.
That’s it. You may send your feedbacks to me on ivarnasi@gmail.com.
Image #21: Put a test message for testng.
Go to your Weblogic Servers’ output console and you will see the message. Outputs look like:=========================================
=> Message received!
=> Message: Hello MQ-Weblogic World!
=> Placing message on WLReplyQueue...
=> Message sent!
=> Closing Connection
=========================================
Now go to MQ explorer and check messages in the second queue – MQReceiverQueue – you should be able to see this message.
Image #22: Queues with messages.
This article is inspired by an article by Sanjay M Kesavan at
http://www-128.ibm.com/developerworks/websphere/library/techarticles/0604_kesavan/0604_kesavan.html
I would like thank Mr. Kesavan, author of above wonderful article.
That’s it. You may send your feedbacks to me on ivarnasi@gmail.com.





















33 comments:
Thank you! Looks very helpful!
I have a few comments:
The example uses MQ "bindings" mode, which requires that MQ and WL servers all run on the same machine. To use an XA capable remote MQ client, configure the MQ connection factory with TCP mode, and use the "WebSphere MQ Extended Transactional Client" instead.
For additional JMS integration information, see FAQs: Integrating Remote JMS Providers. The FAQ explores other options and has numerous links into WebLogic documentation. For even further help, one can try posting to the
weblogic.developer.interest.jms newsgroup.
Tom Barnes, BEA Systems
WebLogic JMS Developer Team
Hi Tom,
Thanks for your feed back and mentioning about JNDI bindings file. I missed to mention this. I will try an example with remote MQ and publish a post when I get some time.
thanks
Ishwara Varnasi
Hi Ishwara,
This post has been very helpful for me. I think there's one very minor error: I think the second line of mq-jndi.properties file should read:
'PROVIDER_URL=file:/C:/MQ-JNDI'
instead of:
'PROVIDER_URL=file:/C:/JNDI-Directory'
Thanks again,
Matt
Matt, thanks for figuring this out. Fixed it.
thanks
Ishwar
Hi Ishwara,
i have followed most of your steps.. n i have written a short test code to put message into the Queue.. but unfortunately, I kept getting this error message
java.lang.UnsatisfiedLinkError: C:\Program Files\IBM\WebSphere MQ\Java\lib\mqjbnd05.dll: Can't find dependent libraries
any idea?
Hi Ishwara,
i have another question. let's say.. if my MQ server is not at the same server as my Weblogic server, how should i configure ? and what should i do?
Thanks in advance
Hi,
I am sorry that I am not getting time to check these things out now. Also I am working on sort of different technologies... I will try to make some time to find solutions. In the mean time, I suggest you to try finding something on related forums.
thanks
Ishwar
Hi,
I have followed all the instructions as mentioned in the post, but the message's are not being picked up by weblogic at all.
When I add a message to the SenderQueue, it just stays there, and there is no action from the MDB deployed on weblogic.
Any idea what could be wrong/missing. Thanks in advance.
Regards,
Pradeep Chellur.
Hi,
I have my MQ Server on a different machine and WLS 10 on a different machine.
Can you help me out with the changes that I need to make so that I don't get this error:
MQJMS2005: failed to create MQQueueManager for hostname:QueueManagerName
Thanks,
-deepa.
Would sincerely hope that you can update your guides to cater for seperate MQ and Weblogic servers setup. I am meeting the exact same issue as deepa.
Thanks,
Chris Chew
Hi Chris/Deepu/Deepa...
My apologies for not having replied to your queries... Unfortunately I am not in a position to answer your questions since I have been working on technologies like SOA/ESB and Web Services for sometime now... I will try out these whenever I get some time... Tom (Tom Barnes) might be able to guide you (us) on these.
thanks
Ishwara Varnasi
Hi All!
Does somebody integrate MQ with Weblogic, that are located on different machines?
Please give some advise, or where can I read about it.
Thank you a lot.
Hi,
Thanks for a very helpful post.
But as many people here have asked - Any pointers on how to do it if MQ Server and WLS are on separate machines?
Thanks in advance.
best regards,
Murali
If you have MQ and Weblogic on separate machines, you must create binding file with connection factory, that have attribute transport=client. This means, that you are using client mode.
Than copy this binding file to machine where WLS is located, and put this location to "JNDI Connection URL" property in Foreign Server configuration.
It is the main difference.
Hi Vito,
Thanks very much for that pointer.
I did not realize that I had to copy the bindings file to the WLS machine :) I was trying to map it thru the network.. :)
Now at least the MDB on WLS attempts to connect to MQ Server on a remote machine, though it fails.
Initially I got a ClassNotFoundException for which I had to add com.ibm.mq.jmqi.jar into WLS/domain/lib folder. That was ok.
Next, it fails with a MQ SecurityException
<28-Dec-2009 16:47:37 o'clock CET> (WMQConnection.java:410)
at com.ibm.msg.client.wmq.internal.WMQXAConnection.(WMQXAConnection.java:70)
at com.ibm.msg.client.wmq.factories.WMQXAConnectionFactory.createV7ProviderConnection(WMQXAConnectionFactory.java:178)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:7331)
at com.ibm.msg.client.wmq.factories.WMQXAConnectionFactory.createProviderXAConnection(WMQXAConnectionFactory.java:101)
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createXAConnectionInternal(JmsConnectionFactoryImpl.java:332)
at com.ibm.mq.jms.MQXAConnectionFactory.createXAConnection(MQXAConnectionFactory.java:98)
at weblogic.ejb.container.internal.JMSConnectionPoller.getXAConnection(JMSConnectionPoller.java:416)
at weblogic.ejb.container.internal.JMSConnectionPoller.getConnection(JMSConnectionPoller.java:463)
at weblogic.ejb.container.internal.JMSConnectionPoller.createJMSConnection(JMSConnectionPoller.java:1991)
at weblogic.ejb.container.internal.JMSConnectionPoller.connect(JMSConnectionPoller.java:826)
at weblogic.ejb.container.internal.MDConnectionManager.startConnectionPolling(MDConnectionManager.java:239)
at weblogic.ejb.container.manager.MessageDrivenManager.start(MessageDrivenManager.java:583)
at weblogic.ejb.container.deployer.MessageDrivenBeanInfoImpl.mdManagerStart(MessageDrivenBeanInfoImpl.java:1163)
at weblogic.ejb.container.deployer.MessageDrivenBeanInfoImpl.deployMessageDrivenBeans(MessageDrivenBeanInfoImpl.java:1143)
at weblogic.ejb.container.deployer.EJBDeployer.deployMessageDrivenBeans(EJBDeployer.java:1674)
at weblogic.ejb.container.deployer.EJBDeployer.deployMessageDrivenBeansUsingModuleCL(EJBDeployer.java:1450)
at weblogic.ejb.container.deployer.MDBServiceImpl.startService(MDBServiceImpl.java:69)
at weblogic.server.ServiceActivator.start(ServiceActivator.java:98)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2063' ('MQRC_SECURITY_ERROR').
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:206)
Possibly some MQ settings, i am still looking into it..
If someone can help ;) thanks in advance.
-Murali
Yup !!! Managed to do it !!! :)
Unfortunately it took a little time for me to get this working...but somehow managed it.
It was something to do with the configuration of Server Connection Channel in MQ Server.
On WLS startup, the MDB was not deployed properly because it was failing with MQSecurityException.
Just googled around and after a lot of trial and error, set the MCAUSER in channel to the same user who logs in. It worked. Have to read more to understand that..
Meanwhile noticed in MQ Explorer that the channel was always inactive :) and somehow missed it all the while..after setting MCAUSER, it started.
Anyways, thanks.
-Murali
The WebLogic documentation links I posted above are out of date. New links:
* JMS Information Roadmap
* FAQ: Integrating Remote JMS Providers
* Using EJB/Servlet JMS Resource References
* Enhanced Support for Using WebLogic JMS with EJBs and Servlets
* Using Messaging Beans
* Programming Message-Driven Beans
* Good MDB with res-ref example (example 9-5)
Tom Barnes, Oracle
WebLogic JMS Developer Team
Thanks a lot, It is very useful.
Tried searching in google, but did not find the right article. Its very useful. And that too, this is first article I read......very useful.
Thanks for your effort.
Hi Ishwara,
We've gone through your article related to Weblogic integration with Websphere MQ for Queues.
We are in the process of integrating Weblogic 10.X with Websphere MQ 6.x for Topic.
"We are getting the following error MQJMS1111: JMS1.1 The required Queues/Publish Subscribe services are not set up".
Can you please help us in resolving the error!
Thanks,
Kamalakar
I tried to integrate this code for our project where MDB listens to a remote MQ server.
I faced following problems
Modify C:\Program Files\IBM\WebSphere MQ\Java\bin\JMSAdmin.bat
Modified java to %MQ_HOME%/java in order to point to corrrect location of IBM JVM.
Indranil Nag
Creation of a remote queue manager bindings by
"C:\Program Files\IBM\WebSphere MQ\Java\bin\JMSAdmin.bat" -v -cfg mq-jndi.properties
use -v option for verbose output.
I tried to recreate on the existing .bindings gave lot of problem .Delete .bindings in case of error.
Enter port and server channel in case of remote mq port
def xaqcf(MQSenderQCF) qmgr(MQTest) HOST(mqhost.mydomain.com) PORT(1417) TRANSPORT(CLIENT) CHANNEL(HPT5.CLNT.WL)
def xaqcf(MQReceiverQCF) qmgr(MQTest) HOST(mqhost.mydomain.com) PORT(1417) TRANSPORT(CLIENT) CHANNEL(HPT5.CLNT.WL)
def q(MQSenderQueue) qmgr(MQTest) queue(MQSenderQueue)
def q(MQReceiverQueue) qmgr(MQTest) queue(MQReceiverQueue)
end
For weblogic deployment copy mq jars to server lib directory otherwise you will get lots of exception for
com.sun.jndi.fscontext.RefFSContextFactory
After copying the mq jars restart the server
Indranil Nag
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 clinet and then run MQ's JMSAdmin utility (Step 5) to bind MQ destination with a JNDI name.
Hi sorry I'm new to weblogic. how do i create MDB and deploy it on weblogic server? is it like some other java class file?
Another question is creating EJB jar file? how do i create it?
Thanks
Also, One may also want to send an MQ message to remote queue from the MDB, in order to do that, old bindings file needs to be deleted and followign executed:
def xaqcf(ReceiverQCF) qmgr(testqmgr)
def xaqcf(SenderQCF) qmgr(testqmgr)
def q(MyMDBQueue) qmgr(testqmgr) queue(MyMDBQueue)
def q(MyRemoteQueue) qmgr(testqmgr) queue(MyRemoteQueue)
end
prior to this channels xmit queues, remote queue and local queues need to be created, also another queue manager. This can be done on the same machine, just second queue manager needs to have another port and listener port needs to change as well. Steps to create remote queues and channels can be found in tutorials of MQ explorer.
Hi ISHWARA,
I wanna know one things. How should I add Primary /Secondary for and in the weblogic-ejb-jar.xml.
Regards
Hi ISHWARA,
I wanna know one things. How should I add Primary /Secondary for destination-jndi and connection factory-jndi in the weblogic-ejb-jar.xml.
MDB is not able to connect destination on the Foreign JMS Server. I have the bindings file for the MQ created in file:/C:/JNDI-Directory
-----------------------------------Contents from weblogic-ejb-jar.xml
MessageDrivenEJBBean
jms/q
jms/qcf
--------------------------------------------------------------------------------
Contents from Config's descriptor file jms/mqintegrationtest-jms.xml
true
jms/q
q
jms/qcf
qcf
com.sun.jndi.fscontext.RefFSContextFactory
file:/C:/JNDI-Directory
Any pointers on this would be appreciated
Hi All..
Earlier I was getting error due to JNDI look up was failed since i have targeted the Foreign server to local jms server ( used advanced targeting instead of Default targetting )
Now I managed to fix it.
But, It quite took long time.
Finally Happy..
The deployment descriptor provided by Ishwar is old and the XSI schema location is not present at all ( I guess ).. Now i have re-edited the
Deployment descriptor to deploy MDB to weblogic latest versions 10.4 etc.
if any one has doubts related to deployment descriptor.. please post.
Special Thanks to Ishwara. Move on..
Thx,
Sara
WebSphere MQ, a member of the WebSphere family from IBM, was the most popular system for messaging across multiple platforms.
.your providing good mater .
IBM MQ SERIES ADMIN ONLINE TRAINING
your providing such a valuabe information about studying..and also have some good key points to every student.
the best pega Online Training training
Hi ISHWARA VARNASI,
Thx for excellent post,very useful for every one.I also follow the blog but I got one issue,i.e
cau u plz guide what I missed.
Regards
Mani
Hi All,
What is the importance of config's descriptor file while integrating weblogic and MQ on different machines? and where should i place this file? Appreciate your responses....
Post a Comment