Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JMS, WebSphere, JNDI = Nightmare

 
Ed Thompson
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Seenu Mu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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???
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic