NameNotFoundException on EJB lookup in standalone client
fchapuis Dec 15, 2004 7:22 PMHi,
I'm trying to test EJB access from a standalone java client.
EJBs are part of J2EE application deploying and working fine on JBoss 3.2.7RC1 (default config).
The client uses the jbossall-client.jar and an app-client.jar with interfaces of EJBs.
Cautiously, I shutdown my personnal firewall.
And here is the EJB from the JNDIView Global Namespace:
+- ejb (class: org.jnp.interfaces.NamingContext) | +- com.fred.demat.core.MyService
Below is the code doing the lookup:
Hashtable env = new Hashtable(); env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces"); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory" ); env.put(Context.PROVIDER_URL, "jnp://localhost:1099"); InitialContext ic = new InitialContext(env); Object objref = ic.lookup("MyService"); Object obj = PortableRemoteObject.narrow(objref, MyServiceHome.class); MyServiceHome testHome = (MyServiceHome)obj; MyService svc = (MyService)testHome.create();
And below is the error:
javax.naming.NameNotFoundException: MyService not bound at org.jnp.server.NamingServer.getBinding(NamingServer.java:490) at org.jnp.server.NamingServer.getBinding(NamingServer.java:498) at org.jnp.server.NamingServer.getObject(NamingServer.java:504) at org.jnp.server.NamingServer.lookup(NamingServer.java:277) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261) at sun.rmi.transport.Transport$1.run(Transport.java:148) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:144) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701) at java.lang.Thread.run(Thread.java:536) at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133) at org.jnp.server.NamingServer_Stub.lookup(Unknown Source) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:544) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:520) at javax.naming.InitialContext.lookup(InitialContext.java:347) at com.fred.test.TestJndiLookup.rmiTest(TestJndiLookup.java:95) at com.fred.test.TestJndiLookup.main(TestJndiLookup.java:43)
I've seen many users having the this kind of problem but found no efficient answer.
If anyone can help, thank you.