Java: InitialContext.lookup(String) - what should the value o the parametr be?

Posted by bguiz on Stack Overflow See other posts from Stack Overflow or by bguiz
Published on 2010-05-17T08:01:59Z Indexed on 2010/05/17 8:10 UTC
Read the original article Hit count: 282

To instantiate a Stateful Session Bean inside of a JSP/ servlet, I am using:

InitialContext ic = new InitialContext();
SomeStateful state = (SomeStateful) ic.lookup("java:comp/env/SomeStatefulBean");

Trial and error had me prefix the name of my EJB with java:comp/env/, so the above works (on Glassfish 2.1). However I want to know what the proper way to obtain this prefix is.

Is there a CLI tool or function somewhere in the admin panel that will allow we to examine/ alter this?

Is this platform/ application server dependant?

Is there a setting within my ear, EJB-jar or war which I can examine or alter for this?

(Forgive the beginner question)

Thanks!

© Stack Overflow or respective owner

Related posts about java

Related posts about jndi