dcsimg
when to use java:comp/env?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   yunfeng_bai
Posted On:   Monday, September 23, 2002 08:45 PM

In the JNDI lookup(), when should I use the prefix "java:comp/env"? It seems that I should do this if i'm finding a EJB or other resource from another EJB that resides in the same appserver, if not, I should use a full JNDI name. Is that the right way? If not, what should I do?

Re: when to use java:comp/env?

Posted By:   Lasse_Koskela  
Posted On:   Tuesday, September 24, 2002 02:45 AM

You can use the java:comp/env virtual context for accessing resources referenced in the deployment descriptors.


For example, if you define an ejb-ref element in your web.xml to reference a separately deployed EJB, you can access that EJB via java:comp/env. If you didn't define a reference, you have to use the real JNDI name, like my.package.structure.MyEJB.


Please, correct me if I'm wrong cos' it's been a while since I've done these things.

About | Sitemap | Contact