|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Configuring Tomcat JMS Connection to WebSphereMQ |
« View previous topic :: View next topic » |
Author |
Message
|
hilltops |
Posted: Tue Dec 03, 2013 2:54 am Post subject: Configuring Tomcat JMS Connection to WebSphereMQ |
|
|
Centurion
Joined: 01 Mar 2006 Posts: 112
|
Hello,
Has anyone got a successful Tomcat JMS Client connection to an MQ queue manager? This question seemed to have been discussed on this forum several times, but no one has confirmed actually implementing a solution that works. Generally, there seems to be two options. 1) A solution where the JNDI admin objects are created using the IBM tool JMSAdmin and stored in the local file system 2) A solution where the JNDI admin objects are specified and stored within the namespace of tomcat. I have been attempting to use option 2, for which there are several examples about on thsi forum and at this site: http://wiki.apache.org/tomcat/HowTo#How_do_I_connect_to_a_Websphere_MQ_.28MQ_Series.29_server_using_JMS_and_JNDI.3F.
This requires a web.xml configures as follows:
<resource-env-ref>
<resource-env-ref-name>jms/MyQCF</resource-env-ref-name>
<resource-env-ref-type>javax.jms.QueueConnectionFactory</resource-env-ref-type>
</resource-env-ref>
<resource-env-ref>
<resource-env-ref-name>jms/MyQ</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
</resource-env-ref>
And a context.xml configured as follows:
<Resource
name="jms/MyQCF"
auth="Container"
type="com.ibm.mq.jms.MQQueueConnectionFactory"
factory="com.ibm.mq.jms.MQQueueConnectionFactoryFactory"
description="JMS Queue Connection Factory for sending messages"
HOST="<mymqserver>"
PORT="1414"
CHAN="<mychannel>"
TRAN="1"
QMGR="<myqueuemanager>"/>
<Resource
name="jms/MyQ"
auth="Container"
type="com.ibm.mq.jms.MQQueue"
factory="com.ibm.mq.jms.MQQueueFactory"
description="JMS Queue for receiving messages from Dialog"
QU="<myqueue>"/>
And the following jars in the classpath:
+--- com.ibm.mq.jar
+--- com.ibm.mqjms.jar
+--- connector.jar
+--- dhbcore.jar
+--- geronimo-j2ee-management_1.0_spec-1.0.jar
+--- geronimo-jms_1.1_spec-1.0.jar
With the above configuration, I get the following error:
[process 618/job:915:[886]]: runtime process terminated uncleanly: failed to open record writer: failed to create jms messenger for writing: connection factory java:comp/env/jms/MyQCF is not the correct type (it is a com.ibm.mq.jms.MQQueueConnectionFactory) (Code: 206,203) (Code: 206,030) (Code: 201,057).
Has anyone come across this problem? If so, how did u solve it?
Many thanks |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Dec 03, 2013 5:51 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You are assuming a few things not in evidence.
- that there is a publicly accessible queue factory... Not a JMS pattern. Under JMS patterns the queues are created off the Session.
Order of instanciation: ConnectionFactory, Connection, Session, Destination (Queue, Topic), Consumer/Producer.
Destination and Consumer / Producers are created by the Session.
The Session is created by the Connection...and the Connection by the ConnectonFactory...
- So deal with it!
What seems to work best so far is to create the initial context using the sun File context reference and then using the application server context to reference that initial context.
Hope it helps  _________________ MQ & Broker admin |
|
Back to top |
|
 |
hilltops |
Posted: Tue Dec 03, 2013 7:04 am Post subject: |
|
|
Centurion
Joined: 01 Mar 2006 Posts: 112
|
Hello,
The back-end has been set with the usual MQ objects (channel, queue, port, listener, MCAUser on channel and auth on queues, etc) and have been tested using amqsputc to work OK. amqsputc has been used to put messages on the queues from the box that hosts the tomcat, ie, tomcat and amqsputc are on the same box.
The problems seems to be with instantiating the JMS objects from the defintitions given in the configuration files (context.xml & web.xml). These files contain the stuff that is use to build JMS objects. In fact, this is the same approach that WAS uses for connecting to MQ, where the JMS defintions are held in the resource.xml file (the equivalent of context.xml for tomcat). Surely, someone must have got this configuration working, given that many people seem to have attempted, by search the web. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|