RMI no such object in table, Server communication error
- by ben-casey
My goal is to create a Distributed computing program that launches a server and client at the same time. I need it to be able to install on a couple of machines and have all the machines communicating with each other, i.e. Master node and 5 slave nodes all from one application.
My problem is that I cannot properly use unicastRef, I'm thinking that it is a problem with launching everything on the same port, is there a better way I am overlooking?
this is part of my code (the part that matters)
try {
        RMIServer obj = new RMIServer();
        obj.start(5225);
    } catch (Exception e) {
       e.printStackTrace();
    }
      try {
            System.out.println("We are slave's ");
            Registry rr = LocateRegistry.getRegistry("127.0.0.1", Store.PORT, new RClient());
            Call ss = (Call) rr.lookup("FILLER");
            System.out.println(ss.getHello());
        } catch (Exception e) {
            e.printStackTrace();
        }
}
this is my main class (above)
this is the server class (below)
public RMIServer() {
        }
    public void start(int port) throws Exception {
        try {
            Registry registry = LocateRegistry.createRegistry(port, new RClient(), new RServer());
            Call stuff = new Call();
            registry.bind("FILLER", stuff);
            System.out.println("Server ready");
        } catch (Exception e) {
            System.err.println("Server exception: " + e.toString());
            e.printStackTrace();
        }
    }
I don't know what I am missing or what I am overlooking but the output looks like this.
Listen on 5225
Listen on 8776
Server ready
We are slave's 
Listen on 8776
java.rmi.NoSuchObjectException: no such object in table
        at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
        at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359)
        at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
        at Main.main(Main.java:62)
line 62 is this      :::           Call ss = (Call) rr.lookup("FILLER");