Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exception not being caught?

Status
Not open for further replies.

Kavius

Programmer
Apr 11, 2002
322
CA
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.
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...
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?
 
Well, I don't know if this will help, but I have found the exact line it is dieing on:
Code:
Login remoteObj = (Login)UnicastRemoteObject.exportObject(serv);
I single stepped through the server and as soon as it ran that line, the program was over.

Does that help? I need help...
 
Wow. This is a stupid thread. If anyone is following it please respond, just so I know I am not talking to myself.

I FORGOT TO RECREATE THE STUB AND SKELETON!

I don't know what, exactly, I changed but obviously it affected the prototype. One quick call to rmic.exe and all of my problems went away. I hope that someone in the future finds this thread useful because I feel like a dope.

Send me a note if you read this...I hate talking to myself...[sad]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top