I have an RMI Server that fails to start. I would assume that this is because of some exception that occurs lower down (it was working, then I modified sub classes heavily) and gets passed up until the thing shuts down.
That's it. That's all. I would expect for at least one other line of code ("Unhandled Exception" or "Server has shutdown"
but I get nothing.
Any ideas?
Code:
public static void main(String[] args) {
System.out.println("Starting Server...");
try {
//create an object
JPMOServer serv = new JPMOServer();
//export the object
Login remoteObj = (Login)UnicastRemoteObject.exportObject(serv);
//make object findable
Registry r = LocateRegistry.getRegistry("localhost",1099);
r.rebind("LOGIN", remoteObj);
BufferedReader rdr = new BufferedReader(new InputStreamReader(System.in));
//Serve clients
System.out.println("Type EXIT to shutdown the server.");
while (true) {
if ("exit".equalsIgnoreCase(rdr.readLine())) {
System.out.println("Shutting down JPMO Server...");
break;
}
}
//unregister object
r.unbind("LOGIN");
//unexport object
UnicastRemoteObject.unexportObject(serv, true);
}
catch (Exception e) {
System.out.println("Unhandled Exception!!");
e.printStackTrace(System.out);
}
//Inform user that server is closed
System.out.println("Server has shutdown.");
}
[code]
The strange thing is, I only get one line of output and the program ends:
[code]
Starting Server...
Any ideas?