Two Laptop Bag*
The moose likes Distributed Java and the fly likes Exception in RMI program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Exception in RMI program" Watch "Exception in RMI program" New topic
Author

Exception in RMI program

Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 266
Hi all,

I am running the following simple code for RMI

MyRemote.java



MyRemoteImpl.java



MyRemoteClient.java


client.policy



I am getting the following exception every time.



Please help me as I am unable to proceed further and I have tried searching the net also but of no avail.

Please Help !!!

Thanks in advance
Vivek Kr Singh
Ranch Hand

Joined: Oct 12, 2007
Posts: 56
at java.rmi.Naming.rebind(Unknown Source)
at com.example.rmi.MyRemoteImpl.main(MyRemoteImpl.java:38)

Is your rmiregistry running ?


SCJP 1.4
Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 266
Hi Vivek,

My RMI Registry is running. I always run it before executing the program. Still its giving the exception




again and again.

Thanks
Siddharth.
Vivek Kr Singh
Ranch Hand

Joined: Oct 12, 2007
Posts: 56
try using this on JDK 1.5

java.rmi.ConnectException: Connection refused to host: hostname; nested exception is:

You must be running server code on same machine on which RMI registry is running. Client code can be executed from any machine provided the skeleton is available.

Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 266
Hi Vivek,

I am using JDK 1.5 and tried the code given by you as well, namely :



But now I get the following exception :


Currently all my code is running on my desktop.

Do we really need skeleton in JDK 1.5 ?

Please Help me get over this problem I am very very upset

Thanks
Siddharth

Vivek Kr Singh
Ranch Hand

Joined: Oct 12, 2007
Posts: 56
Suggest you to read Sun's RMI Hello World Page
Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 266
Hi Vivek,

Problem was solved.

There was a code change which was to be done.


Thanks
Siddharth
 
wood burning stoves
 
subject: Exception in RMI program