Hi,
I am trying to get the jndi context in my EJB client as shown below.
System.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
System.setProperty("java.naming.provider.url",
"localhost:1099");
Context jndicontext = new javax.naming.InitialContext();
System.out.println("initial context :"+ jndiContext);
Object ref = jndiContext.lookup("java:comp/env/Cabin");
<====== ?????????
System.out.println("Reference :"+ref);
CabinHome home = (CabinHome)
PortableRemoteObject.narrow(ref,CabinHome.class);
My question is when I do a lookup on just "Cabin" it works fine.But
when I try to use
"java:comp/env/Cabin" I dont get the EJBhome Reference.Correct me if
I am wrong.I think
by using "java:comp:/env" I should be able to get the reference.
I checked the EJB 1.1 specification and I quote
8.2.1 Locating an entity bean�s home interface
A client locates an entity bean�s home interface using JNDI.
For example, the home interface for the Account entity bean can be
located using the following code segment:
Context initialContext = new InitialContext();
AccountHome accountHome = (AccountHome)
javax.rmi.PortableRemoteObject.narrow(
initialContext.lookup(�java:comp/env/ejb/accounts�),AccountHome.class);
A client�s JNDI name space may be configured to include the home
interfaces
of enterprise beans deployed in multiple EJB Containers located on
multiple
machines on a network. The actual location of an EJB Container is,
in general,
transparent to the client.
I would appreciate an explanation.
PKD
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]