aspose file tools*
The moose likes Distributed Java and the fly likes Why am I getting java.rmi.NotBoundException exception on localhost rmi test. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Why am I getting java.rmi.NotBoundException exception on localhost rmi test." Watch "Why am I getting java.rmi.NotBoundException exception on localhost rmi test." New topic
Author

Why am I getting java.rmi.NotBoundException exception on localhost rmi test.

Jo Jake
Greenhorn

Joined: Apr 14, 2012
Posts: 18
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.
Jo Jake
Greenhorn

Joined: Apr 14, 2012
Posts: 18
Anybody who have worked in RMI here to help me ?
Edward Harned
Ranch Hand

Joined: Sep 19, 2005
Posts: 291

It's hard to look at someones code and figure out what is wrong. It's like looking at a misspelled word.

Probable you haven't exported the remote object. The following is from a test program I use.



Now you bind/rebind the object "cb".


Ed's latest article: A Java Parallel Calamity http://coopsoft.com/ar/Calamity2Article.html
 
Consider Paul's rocket mass heater.
 
subject: Why am I getting java.rmi.NotBoundException exception on localhost rmi test.
 
Similar Threads
RMI server startup exception
HFJ - RMI issues.
RMI unmarshling error while registering
What is error?
no security manager: RMI class loader disabled