I have a servlet that finds/creates a session bean.
The session bean instantiates a non-bean java object.
That java object tries to find an EJB, but fails with
the usual: javax.naming.NameNotFoundException:
java:comp/env/ejb/TestDocument1
Why? Aren't the servlet, java object, and EJB all
running in the same JVM and context? I've tried the
three usual methods for finding the EJB:
1)
Context ctx = new InitialContext();
Object boundObject = ctx.lookup("java:comp/env/ejb/TestDocument1");
2) this one wants the application-client.xml:
java.util.Properties props = new java.util.Properties();
props.setProperty("java.naming.factory.initial","com.evermind.server.Applica
tionClientInitialContextFactory");
props.setProperty("java.naming.provider.url","ormi://localhost/docmgr");
props.setProperty("java.naming.security.principal","zzz");
props.setProperty("java.naming.security.credentials","zzz");
Context ctx = new InitialContext(props);
Object boundObject = ctx.lookup("java:comp/env/ejb/TestDocument1");
3) same as #2 but with RMIInitialContextFactory:
props.setProperty("java.naming.factory.initial",
"com.evermind.server.rmi.RMIInitialContextFactory");
Any hints as to what I'm doing wrong?
-tim