I am new to
Java as well as rmi. While running a
test code I end up with exceptions and couldn't make it work. All I had is just a hello message from server. I get the java.rmi.NotBoundException when I call
Naming.lookup I tried with different values for lookup url such as
rmi://127.0.0.1/serviceA,
rmi://localhost/serviceA etc ..but nothing did worked for me. Anyone please could help me to get this working.
Here is my server code :
And this server code compiles and runs without any issues.
Client code :
The client code compiles without any issues, and on running give the following :
The stack trace of exception :
java.rmi.NotBoundException: serviceA
at sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:134)
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:409)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:267)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:273)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:251)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:377)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:101)
at rmiclient.main(rmiclient.java:16)
Exception in thread "main" java.lang.NullPointerException
at rmiclient.main(rmiclient.java:21)
Thanks for any effort, probably many might have experienced the same I hope.