Thursday Feb 05, 2009

Connecting to Java MQ through JNDI Programmatically


The following document goes through how
to set up JNDI for a queue in Java MQ and then gives you source code
to read and write to the queue. This source can be used as a basis to
send messages to Java CAPS for automated testing within your Java
CAPS implementation.


I have only tried the program on my
localhost, so I'm not sure how well these instructions will hold up
for remote hosts. When I get a chance to try it out and getting it
working, I'll update this document.


Comments:

For remote hosts the c:/ JNDI file will be an issue. Can we store the JNDI information in the Glassfish JNDI store? I investigated this approach and I found that it is not easy to grab the InitialContext. Information here https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
I am very interested into this topic if we can find a simple, lightweight and manageable Java MQ client JNDI based. Currently, I am not using JNDI and just using the specific ConnectionFactory for Java MQ. This way I just have to bundle jms.jar and imq.jar and not any JNDI provider. I don't need a JNDI configuration. Just, the hostname in a property file in the client side. The overall configuration is simpler.

Posted by Eric Lerognon on February 05, 2009 at 07:37 PM EST #

Post a Comment:
  • HTML Syntax: NOT allowed