I have the folloving RMI server:
public static void main(String[] args) {
try{
ChatSystemImpl chatSystem = new ChatSystemImpl();
ChatSystem chatSystem_stub = (ChatSystem) UnicastRemoteObject.exportObject(chatSystem, 6001);
Registry registry = LocateRegistry.getRegistry("localhost", 6001);
registry.bind("ChatSystem1", chatSystem_stub);
System.out.println("Server up.");
}
catch(Exception ex){
ex.printStackTrace();
}
}
When I run it I get:
ava.rmi.NoSuchObjectException: no such object in table
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.bind(Unknown Source)
at fr.inp.ensimag.examples.chatsystem.Main.main(Main.java:30)
Well I have no idea whats wrong... Staring on it for more then 2 hours right now.
This is the interface (if needed):
public interface ChatSystem extends Remote{
void registerUser(UserInfo newUser) throws RemoteException;
void unregisterUser(UserInfo user) throws RemoteException;
boolean userExists(UserInfo user) throws RemoteException;
void send(MessageInfo message) throws RemoteException;
}
The implementation has following header, the body just contains methods that are not really implemented, they just thow UnsupportedOperationException
:
public class ChatSystemImpl implements ChatSystem
The ChatSystem
interface is in other project then the rest of source code if it is of any importance.
Thank you.