This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes EJB and other Java EE Technologies and the fly likes Logical names Vs JNDI names Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Logical names Vs JNDI names" Watch "Logical names Vs JNDI names" New topic
Author

Logical names Vs JNDI names

shetal bansal
Ranch Hand

Joined: May 09, 2005
Posts: 63
Hi,
Can anyone tell me the difference between a "logical name" like "java:/comp/env/ejb/Fibo" and a jndi name like onl "FiboBean".
I can use both of of them as inputs to InitialContext constructor, but what is the difference?
I am new to ejb, so this might be a stupid question, but would appreciate any explanations.. .
Thanks in advance,
Shetal
[ August 19, 2005: Message edited by: shetal bansal ]
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2053
Originally posted by shetal bansal:
Hi,
Can anyone tell me the difference between a "logical name" like "java:/comp/env/ejb/Fibo" and a jndi name like onl "FiboBean".
I can use both of of them as inputs to InitialContext constructor, but what is the difference?
I am new to ejb, so this might be a stupid question, but would appreciate any explanations.. .
Thanks in advance,
Shetal

[ August 19, 2005: Message edited by: shetal bansal ]


First of all, for "java:comp/env/ejb/FiboBean":

-->"java:comp/env" is always there

-->"ejb/FiboBean" is an id that you made up yourself, that identifies the item


There are two ways you can do the lookup:

#1) specifying the whole thing "java:comp/env/ejb/FiboBean"; where 'ejb/FiboBean' is the unique id within the environment represented by "java:comp/env"

#2)
#2.a. specify the initial context as "java:comp/env/ejb"
#2.b. do the lookup using "FiboBean"

both of these #1 and #2 end up doing exactly same lookup; a look up on "java:comp/env/ejb/FiboBean"
[ August 19, 2005: Message edited by: Jesus Angeles ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Logical names Vs JNDI names