title: Java RMI NoSuchObjectException
body: <p>I have a server and client using Java RMI. If I use one client all is fine with the code below. But if I connect with a client and then a second one, it throws port already in use exception. That's fine, so I disconnect the connected client and then try to connect with the second client again. It gives me this:</p>
  
  <p>java.rmi.NoSuchObjectException: no such object in table</p>
  
  <p>Why is this?</p>
  
  <pre><code>//CONNECT
  
  Registry registry = LocateRegistry.getRegistry(
      Options.getRegistryIp(), Options.getRegistryPort());
  server = (IServer) registry.lookup(Constants.MB_SERVER_NAME);
  
  UnicastRemoteObject.exportObject(client, Options.getMyPort());
  server.registerClient(client);
  
  //DISCONNECT
  
  server.removeClient(client, client.getUser());
  UnicastRemoteObject.unexportObject(client, false);
  </code></pre>