wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes JMS, WebSphere, JNDI = Nightmare Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JMS, WebSphere, JNDI = Nightmare" Watch "JMS, WebSphere, JNDI = Nightmare" New topic
Author

JMS, WebSphere, JNDI = Nightmare

Ed Thompson
Ranch Hand

Joined: Jan 20, 2006
Posts: 43
I am looking for some help getting JMS working under WebSphere.
Using RAD 7.0.0.4 and WebSphere 6.1.0.2.

I started with the example at http://www.ibm.com/developerworks/websphere/library/techarticles/0504_barcia/0504_barcia.html .
I was able to get it up and running, and ran the test case in the article.

However, when I tried to use the 'Send JMS Message' facility of the Universal test Tool, I go:

com.ibm.ws.sib.api.jms.impl.JmsManagedConnectionFactoryImpl incompatible with org.omg.CORBA.portable.ObjectImpl

Rather than spin my wheels, I jumped to trying to write a message to the Queue from a servlet. I copied the code from MessageProducerBean into a servlet. The code throws an exception when trying to grab the connection factory:

Name comp/env/jms not found in context "java:".


The JNDI reference exists in the global context, but not in the 'java:' context:




I have added a reference to web.xml:


Not sure where to look next.

Help?

Ed
[ October 30, 2007: Message edited by: Ed Thompson ]

Even if the voices <i>aren't</i> real, they still have some good ideas!
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

Yeah...Um...Try my tutorials. They're simpler and they're better. Plus, it's fully multimedia, so you can see every single step I perform to get the end results.

There's a huge amount of stuff you need to do to get messaging working properly. One little mess up can stop the whole thing from working. It can be a nightmare if you're not careful.

Setting up Java Messaging on WebSphere, Rational Application Developer and the Test Environment

Developing Message Driven Bean EJBs (MDBs) and Session Bean Clients to Write a Message

Good luck, and enjoy!!!

-Cameron McKenzie
Ed Thompson
Ranch Hand

Joined: Jan 20, 2006
Posts: 43
YES! After 3 days, I finally got it to work! What a pain!!! (The IBM doc is scattered all over the place. Never seems to be a place for one stop shopping)

I had to bind the reference in the web.xml file. Under RAD7 that meant:

1) From the deployment descriptor references tab, add a WebSphere binding of jms/MyConnectionFactory.

2) At first blush, this only added an id to what I had before:



However, buried in ibm-web-bnd.xmi is where the dots get connected:



In the code I had to change the lookups from "jms/MyConnectionFactoryRef" to "jms/MyConnectionFactory". I also had to change the code in the servlet from looking up a Destination to looking up the queue.

The outstanding question? Did I break a best practice by removing 'Ref' and Destination, or is this a necessity of Writing to the queue from a servlet instead of an EJB?

Also, this was not real intuitive - how would I have known to do this? How would i have done this manually had I not been working in RAD?

Anyone?
Ed Thompson
Ranch Hand

Joined: Jan 20, 2006
Posts: 43
Cameron, checking out your tutorial now.

On a separate note, what software do you use to generate those?

Ed
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

I know the steps you missed. They are not documented well, if documented at all.

Please enjoy the tutorials. They were made with Camtasia, I believe.

camtasia computer screen recording software

-Cameron McKenzie
Nikhil Menon
Ranch Hand

Joined: Nov 22, 2004
Posts: 70
In case someone is still looking for the same, these links might help.

http://www.redbooks.ibm.com/redbooks/SG247611/wwhelp/wwhimpl/js/html/wwhelp.htm
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/welc6tech_si.html
Seenu Mu
Greenhorn

Joined: Sep 29, 2011
Posts: 1
Here is the MQ / JMS JNDI connection factory configuration.

Through admin console the connection factory and queue are configured.

<resource-ref id="ResourceRef_123456785456">
<description></description>
<res-ref-name>myconnectionfactory</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref id="ResourceRef_14313453543626456">
<description></description>
<res-ref-name>myqueue</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
vik ar
Ranch Hand

Joined: Jul 31, 2009
Posts: 104
Ed Thompson wrote:YES! After 3 days, I finally got it to work! What a pain!!! (The IBM doc is scattered all over the place. Never seems to be a place for one stop shopping)

I had to bind the reference in the web.xml file. Under RAD7 that meant:

1) From the deployment descriptor references tab, add a WebSphere binding of jms/MyConnectionFactory.

2) At first blush, this only added an id to what I had before:



However, buried in ibm-web-bnd.xmi is where the dots get connected:



In the code I had to change the lookups from "jms/MyConnectionFactoryRef" to "jms/MyConnectionFactory". I also had to change the code in the servlet from looking up a Destination to looking up the queue.

The outstanding question? Did I break a best practice by removing 'Ref' and Destination, or is this a necessity of Writing to the queue from a servlet instead of an EJB?

Also, this was not real intuitive - how would I have known to do this? How would i have done this manually had I not been working in RAD?

Anyone?


What is the xmi:id="WebAppBinding_1193169214386" for???
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JMS, WebSphere, JNDI = Nightmare
 
Similar Threads
active mq
launchClient
JNDI Lookup Exception
Could not instantiate a bound object (WAS 5.0 JNDI)
QueueConnectionFactory not bound