Re: Problem accessing EJB from client
The lookup must be in the same named application as the ejb server, so the provider url must include the application name like ormi://localhost/app_name This is the most likely cause of a NameNotFoundException. At 19:45 4/23/2001 +0100, you wrote: Hi, I am successfully accessing my Session Bean from my servlets (servlet and EJB are packaged in an EAR). Context ctx = new InitialContext(); Object ref = ctx.lookup(UserManager); UserManagerHome home = (UserManagerHome)PortableRemoteObject.narrow (ref,user.ejb.UserManagerHome.class); UserManager userManager = home.create(); I would like now to access the EJB another client (another JVM). My client is initialized like this: ht.putContext.INITIAL_CONTEXT_FACTORY, com.evermind.server.rmi.RMIInitialContextFactory); ht.put(Context.PROVIDER_URL, ormi://localhost/); ht.put(Context.SECURITY_PRINCIPAL, admin); ht.put(Context.SECURITY_CREDENTIALS, admin); Context ctx = new InitialContext( ht ); But when I do: Object ref = ctx.lookup(UserManager); I have : [junit] BEFORE LOOKUP [junit] javax.naming.NameNotFoundException: UserManager not found [junit] at com.evermind.server.rmi.RMIContext.lookup(JAX) [junit] at javax.naming.InitialContext.lookup(InitialContext.java:350) Is there something obvious I am missing ?? Thanks, Olivier
Re: Problem accessing EJB from client
The lookup must be in the same named application as the ejb server, so the provider url must include the application name like ormi://localhost/app_name This is the most likely cause of a NameNotFoundException. At 19:45 4/23/2001 +0100, you wrote: Hi, I am successfully accessing my Session Bean from my servlets (servlet and EJB are packaged in an EAR). Context ctx = new InitialContext(); Object ref = ctx.lookup(UserManager); UserManagerHome home = (UserManagerHome)PortableRemoteObject.narrow (ref,user.ejb.UserManagerHome.class); UserManager userManager = home.create(); I would like now to access the EJB another client (another JVM). My client is initialized like this: ht.putContext.INITIAL_CONTEXT_FACTORY, com.evermind.server.rmi.RMIInitialContextFactory); ht.put(Context.PROVIDER_URL, ormi://localhost/); ht.put(Context.SECURITY_PRINCIPAL, admin); ht.put(Context.SECURITY_CREDENTIALS, admin); Context ctx = new InitialContext( ht ); But when I do: Object ref = ctx.lookup(UserManager); I have : [junit] BEFORE LOOKUP [junit] javax.naming.NameNotFoundException: UserManager not found [junit] at com.evermind.server.rmi.RMIContext.lookup(JAX) [junit] at javax.naming.InitialContext.lookup(InitialContext.java:350) Is there something obvious I am missing ?? Thanks, Olivier