Meaningless Drivel is fun!*
The moose likes EJB and other Java EE Technologies and the fly likes JNDI lookup java:comp/env/ in WSAD Test Server for P2P JMS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JNDI lookup java:comp/env/ in WSAD Test Server for P2P JMS" Watch "JNDI lookup java:comp/env/ in WSAD Test Server for P2P JMS" New topic
Author

JNDI lookup java:comp/env/ in WSAD Test Server for P2P JMS

Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
I am having dificulty in looking up quefactory and queue name from WSAD 5.1.x test server using java:comp/env/.

qcf : name of queueconnectionfactory.
q : name of queue.

When I start WSAD test server, I see JNDI bindings as jms/qcf and jms/q in console.

I can successfully look up queueconnection factory and queue in Java code as:

jms/qcf
jms/q

I get NameNotFound Exception when I try to look them up using:

java:comp/env/jms/qcf
java:comp/env/jms/q

Any idea?
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Sam,


I can successfully look up queueconnection factory and queue in Java code as:

jms/qcf
jms/q

I get NameNotFound Exception when I try to look them up using:

java:comp/env/jms/qcf
java:comp/env/jms/q

I�m no WSAD expert but my guess is that your problem is related to ejb-references and the ENC (Environment Naming Context). The way it works is like this: server deployed applications can define references or other environment specific variables. The container will bound those variables to ENC and will allow all components within the same application to access them using normal jndi lookup operations and the java:comp/env syntax. However these references act like �local� variables and as I said they can be located only by components deployed within the same application. Hence if you defined such a reference from within web.xml file than you can access that resource (using ENC & the java:comp/env syntax) from within any servlet or jsp in the same war. However it will not work with remote clients or components located within other wars.
The jms/qcf or jms/q on the other habd is kind of �global� syntax and it works with all type of clients (remote clients as well as all other server components).
Regards.


I think, therefore I exist -- Rene Descartes
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JNDI lookup java:comp/env/ in WSAD Test Server for P2P JMS
 
Similar Threads
WSAD JMS Configuration
Registering JMS Resources
MQJMS write problem in WSAD 5.0
Failed to open Queue using MDB in WSAD using MQ Simulator (MQJMS2008)
JMS Configuration problem