[jboss-user] [JNDI/Naming/Network] - Re: ClassCastException on remote calling of an EJB3.0
broneo
do-not-reply at jboss.com
Mon Jul 30 12:00:27 EDT 2007
Hello again,
after trying to establich a database connection i get the error i got before when using ClientBean/remote.
This is my source code:
Hashtable env = new Hashtable();
| env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
| env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
|
| final Context ic = new InitialContext(env);
| ClientRemote client = (ClientRemote)ic.lookup("ClientBean/remote");
| System.out.println("ClientBean is bound to: " + client);
| TemControlClient test = client.getClient(1);
| System.out.println("getClient returns: " + test);
| test = client.getClient(3);
| System.out.println("getClient returns: " + test);
and this is the output i got:
Exception in thread "main" javax.naming.NameNotFoundException: remote not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
at sun.reflect.GeneratedMethodAccessor81.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
at java.lang.Thread.run(Thread.java:613)
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:126)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.planetactive.ejb.client.Main.main(Main.java:42)
Java Result: 1
The exception is thrwon in this line:
ClientRemote client = (ClientRemote)ic.lookup("ClientBean/remote");
So i think my program can`t find the JNDI Name.
Thnks for your help in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4068788#4068788
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4068788
More information about the jboss-user
mailing list