Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Runtime error  RSS feed

 
Chandar S Vellithirumutha
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
i am trying to run a small rmi program. I am getting socket refused exception. Can any one help me in this. Here is the program.......

Thanks a bunch
Chandar
import java.util.*;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface RMIMain extends Remote {
public int getRandomNumber() throws RemoteException;
}
import java.rmi.*;
import java.io.*;
import java.rmi.server.*;
import java.rmi.registry.*;
public class RemoteObject extends UnicastRemoteObject implements RMIMain {
Registry registry;
public RemoteObject() throws Exception {
setRMIRegistry();
}

public int getRandomNumber() {
return (int) (Math.random() * 100000) ;
}
public void setRMIRegistry() {
try {
registry = LocateRegistry.getRegistry(1099);
// registry.list();

if (registry == null) {
registry = LocateRegistry.createRegistry(1099);
}
registry.rebind("RMI",this);
}catch(Exception e) {
e.printStackTrace();
}
}
public void deleteRMIRegistry() {
try {
registry.unbind("RMI");
}catch(Exception e) {
e.printStackTrace();
}

}
public static void main(String args[]) throws Exception {

RemoteObject RObject = new RemoteObject();
}
}
 
Milind Kulkarni
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post the client program and the detailed exception message.
Regards,
Milind
 
Chandar S Vellithirumutha
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Milind
I haven't yet coded the client part yet. But i could not run rmi registry to keep the server process going. Can you please help me in this regard.
Thanks for your help
Chandar
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!