It's not a secret anymore!
The moose likes EJB and other Java EE Technologies and the fly likes java:comp/env - required? 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 - required?" Watch "java:comp/env - required?" New topic

java:comp/env - required?

Neil Rapley

Joined: Jun 22, 2001
Posts: 1
Is the prefix java:comp/env required when assigning a JNDI name to an EJB? I have named mine without any prefix and it seems to work fine. Are there any consequences of not using it?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

Using java:comp/env/ejb makes it portable, as well as declaring that the object is question "is" an EJB. On the other hand, I have several legacy beans that are setup the way you mentioned. All that's really necessary is that however you refer to it, that the process of resolving the JNDI name returns the home of the item in question.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: java:comp/env - required?
jQuery in Action, 3rd edition