JNDI lookup java:comp/env/ in WSAD Test Server for P2P JMS
Sam Gehouse
Ranch Hand
Joined: Jul 21, 2003
Posts: 281
posted
0
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
posted
0
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.