Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URGENT Please!!! JNDI Naming :)

 
Darryl Perrett
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got a question about JNDI Naming... I set up my EJB Modules with a reference name such as '/ejb/MyEJBModule' and doing a lookup on this name works fine. My question is, how can the lookup also locate the resource using the 'java:comp/env' root context? (ie: 'java:comp/env/ejb/MyEJBModule'). Does the lookup assume the 'java:comp/env' root context as default for all environment variables? Any help would be appreciated
[ July 30, 2002: Message edited by: Darryl Perrett ]
 
Vinod Bijlani
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes all the env variables are prefixed with 'java:comp/env'
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The 'java:comp/env' is the specified prefix for variables, as it is mentioned in the J2EE spec
 
pjoisha
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you need to do is first create this ejb-ref in your ejb-jar.xml (in the References tab) and then map that ejb-ref (like /ejb/MyEJB) to the Global JNDI name of the component (like '/ejb/com/mycompany/sample/MyEJBModule/mySampleEJBHome') u are trying to refer.
You tie this in the extensions editor (bindings tab). Once you have done this you can then start using the local JNDI names like this in ur code ...
context.lookup("java:comp/env/ejb/MyEJB");
Hope that helps.
PJ
Oh BTW ... this discussion is relevant to WSAD ... but the idea is the same if ur were to hand code ejb-jar.xml and ibm-ejb-jar-bnd.xmi.
[ July 31, 2002: Message edited by: Prashanth Joisha ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic