Hi,
in my
opinion java:comp/env/ is a shared Namespace for J2EE components (Servlets,
JSPs, EJBs, ...). If an EJB is bound to the JNDI name 'ejb/FooHome', e.g.
a servlet would have to look up the home interface by using
"java:comp/env/'ejb/FooHome".
This
does not seem to be neccessary - "ejb/FooHome" will do just fine. That way also
works for "remote" clients, i.e. just use "ejb/FooHome" in connection with the
"com.evermind.server.rmi.RMIInitialContextFactory" when using
stand-alone Java Application CLients.
Bye
Hartmut
Heya. Your guidance on the mailing list has been
most useful. I've got a slight problem though.
I've managed to follow and connect using fully
qualified RemoteInterface names...
but upon trying the JNDI connection, I received
an....
javax.naming.NamingException: java:comp/env
namespace is only available from within a J2EE component.
I've tried various namespaces, but they failed to
find the corresponding bean. What's wrong ?
---
// Connect to Orion 1) Use the fully
qualified RemoteInterface name for the lookup 2) Use the JNDI
Name If you use this option, you will have to modify
your application-client.xml file to read:
<application-client>
<ejb-ref>
<ejb-ref-name>ejb/FooHome</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.foo.FooHome</home>
<remote>com.foo.Foo</remote>
</ejb-ref>
</application-client>
public void
doSomethingWithJNDI(InitialContext ctx)
throws NamingException
{ FooHome home =
(FooHome) PortableRemoteObject.narrow(ctx.lookup("java:comp/env/ejb/FooHome"), FooHome.class);
Foo foo =
home.create();
foo.doSomething();
}
|