Thanks David On 9/12/07, David Blevins <[EMAIL PROTECTED]> wrote: > > On Sep 12, 2007, at 6:27 PM, Karan Malhi wrote: > > > Dain, > > > > Installation was successful!!. > > > > However, I put my bean classes in the classes directory, tried to look > > it up from a servlet and am getting the following exceptoin. What am I > > doing wrong? I am just tired, prolly need a strong cup of coffee. > > > > javax.naming.ServiceUnavailableException: Cannot lookup > > '/GreetingBeanBusinessRemote'. [Root exception is > > java.net.ConnectException: Cannot connect to server > > 'foo://127.0.0.1:4201'. Check that the server is started and that the > > specified serverURL is correct.] > > > You should use the LocalInitialContextFactory instead of the > RemoteInitialContextFactory. > > The LocalInitialContextFactory is used to connect to containers in > your vm. > The RemoteInitialContextFactory is used to connect over a network to > containers in another vm. > > You could use the RemoteInitialContextFactory to connect to ejbs in > your webapp, but you'd have to specify the serverUrl which would be > something like this: > > Properties p = new Properties(); > p.put("java.naming.factory.initial", > "org.apache.openejb.client.RemoteInitialContextFactory"); > p.put("java.naming.provider.url", "http://127.0.0.1:8080/openejb/ > ejb"); > InitialContext context = new InitialContext(p); > context.lookup("GreetingBeanBusinessRemote"); > > Though, I'd only ever use that style if you wanted to connect via a > standalone EJB client application. Use the > LocalInitialContextFactory for looking up anything in your same vm. > > Properties p = new Properties(); > p.put("java.naming.factory.initial", > "org.apache.openejb.client.LocalInitialContextFactory"); > InitialContext context = new InitialContext(p); > context.lookup("GreetingBeanBusinessRemote"); > > > -David > >
-- Karan Singh Malhi