Thanks Harish, this was very helpful for me also.
 
Colin
----- Original Message -----
Sent: Tuesday, February 05, 2002 7:10 PM
Subject: Re: JRun/JNDI Question

Hi,
When u lookup , u don't put the HOME name., Instead its r Remote name ( or the name u bound to the registry)
 
It should be
 
Object ref = jndiContext.lookup( "java:comp/env/ejb/Customer");
EJBHome home = (EJBHome) PortableRemoteObject.narrow(ref, CustomerHome.class);
 
 
 
You need to initialize the InitialContext(..) with the properties of
ur application server, if ur client program is not in the same JVM.
 
        Properties h = new Properties();
 
  //factory=org.jnp.interfaces.NamingContextFactory
  //url=jnp://myhost:1099
 

        h.put(Context.INITIAL_CONTEXT_FACTORY, factory);
        h.put(Context.PROVIDER_URL, url);
        if (user != null) {
            h.put(Context.SECURITY_PRINCIPAL, user);
            if (password == null)
                password = "";
            h.put(Context.SECURITY_CREDENTIALS, password);
        }
 
        ctx = new InitialContext(h);
        Object ref = ctx.lookup("BeanToFind");
        EJBHome home = (EJBHome) PortableRemoteObject.narrow(ref, type);
 
 
 
Harish

Reply via email to