Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Sam Gehouse
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic