wood burning stoves
The moose likes EJB and other Java EE Technologies and the fly likes java:comp/env/ejb/jndi-name. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "java:comp/env/ejb/jndi-name." Watch "java:comp/env/ejb/jndi-name." New topic


Vin Kris
Ranch Hand

Joined: Jun 17, 2002
Posts: 154
Hi Ranchers
I am trying to configure my application to invoke one EJB from another. I am trying to use <ejb-ref> tag in ejb-jar.xml (using WSAD 4.0.3). But i'm not able to look-up the ejb.
My questions:
1) <ejb-ref-name> is the JNDI name. isn't it?
2) if I give the value for above as "MyEJB", then do I have to look-up as "java:comp/env/ejb/MyEJB" ? Is this the case for remote EJBs only (in a diff. container) or for local EJBs also (same container)?
I am confused with using the JNDI. Any assistance is appreciated. Could somebody please point me in the right direction. good ol' Google is consuming a lot of time.
Nitzan Levi

Joined: Feb 19, 2003
Posts: 22
1. no. the ref name is the name that you will use form java:comp. in the websphere bindings there's the mapping between the ref name and the jndi name.
so lets say your ref anme is MyEjb so you will access it from java:comp/env/MyEjb.
2.it is true for both local or remote , but they need to be stored in the same jndi server.

nitzan levi :-)
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
Hi Vin,
One question here.
Are you trying to test your lookup within WSAD (I mean WTE) or from a deployed application onto WebSphere ?
Unfortunately, it does not work exactly the same way in both.
Your code will lookup from "java:comp/env/ejb/MyEJB". But as its name says, it is a reference. Once deployed, you have to map a real EJB/JNDI name to this reference.
With WebSphere, this is done during the deployment process or thu the "EJB reference" tabpage of the admin console.
With WSAD, as far as I know, there is no UI to do it. But I hopethis IBM document could help you

/ JeanLouis<br /><i>"software development has been, is, and will remain fundamentally hard" (Grady Booch)</i><br /> <br />Take a look at <a href="http://www.epfwiki.net/wikis/openup/" target="_blank" rel="nofollow">Agile OpenUP</a> in the Eclipse community
I agree. Here's the link: http://aspose.com/file-tools
subject: java:comp/env/ejb/jndi-name.
It's not a secret anymore!