This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes java:comp/env Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "java:comp/env" Watch "java:comp/env" New topic
Author

java:comp/env

Manish Shinde
Ranch Hand

Joined: Mar 30, 2011
Posts: 39
Is possible run following
Context envCtx=(Context) initialContext.lookup("java:comp/env/"); in the standalone java program(without using any application server and web-server) ?

Thanks in advance.
manish
Lanny Gilbert
Ranch Hand

Joined: Jun 11, 2002
Posts: 103
Short answer is no..

From the OpenEJB website..

■"My Client can't lookup the EJB from java:comp/env"
A plain, standalone, Java application cannot use java:comp/env. There is the official concept of a Java EE Application Client which can be packaged in an ear and deployed into the Container. In practice, most people find them restrictive, cumbersome, and hard to use and are therefore rarely employed in "real world" projects. Most people opt to use the non-standard, vendor-specific, approach to looking up EJBs from their plain java clients. In OpenEJB this can be done via either the RemoteInitialContextFactory (for remote clients) or the LocalInitialContextFactory (for local clients of an embedded container). The JNDI names can be configured as shown here: http://openejb.apache.org/3.0/jndi-names.html. NOTE: These are EJB lookups, so maybe not pertinent for what you're trying to do.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java:comp/env
 
Similar Threads
How to Use the JNDI naming context java:comp/env to access enterprise bean's environm
How to Use the JNDI naming context java:comp/env to access enterprise bean's environm
database connection from JNDI
Why does UserTransaction appear in 2 categories?
resin-web.xml