File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes about rmiregistry Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "about rmiregistry" Watch "about rmiregistry" New topic
Author

about rmiregistry

Holmes Wong
Ranch Hand

Joined: Feb 18, 2002
Posts: 163
Hi,
I use the following commands to start server:

After I stop the server, and exit the console,
if I want to restart the server again, I got
the following error: "Port already in use."
Does that mean rmi registry still listen on
the port (I use the default port)? How can I
fix this?
Ying Ren
Ranch Hand

Joined: May 24, 2002
Posts: 35
hi,
I have encounted the same problem. I fixed it by adding the code:System.exit(0). I don't know the exact reason. I guess, the stop server is not exit the server, so the port still be used.
Am I right?

Ying Ren
Ian B Anderson
Ranch Hand

Joined: Jun 26, 2001
Posts: 275
Hello,
The RMI Registry is a seperate process basically it binds to a port (1099) by default. Your Java program (the Server) looks up on the Registry to retrieve an object but other than that it has nothing to do with the registry. There is no reason for the registry to die just because your Java program terminates.
You will need to kill the RMI Registry and the exit the server program every time you wish to re-run. Alternatively I would have thought you can get away with leaving the RMI Registry running but just restarting the Java server. So use this first time:
rmiregistry &
java -jar -server.jar &
Then just use:
java -jar -server.jar &
Good luck
Ian
Holmes Wong
Ranch Hand

Joined: Feb 18, 2002
Posts: 163
Thanks guys.
Ying: where did you put System.exit(0)? Since your
server always runs. Did you provide a gui for your
server?
Ian: That is what I am thinking, its just a bit
too restrictive.
[ July 14, 2002: Message edited by: Holmes Wong ]
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

After I stop the server, and exit the console,
if I want to restart the server again, I got
the following error: "Port already in use."

The other way to do it is to start the registry from the server program itself. When the server shuts down, it will shut down the registry as well.
Eugene.
Holmes Wong
Ranch Hand

Joined: Feb 18, 2002
Posts: 163
Originally posted by Eugene Kononov:

The other way to do it is to start the registry from the server program itself. When the server shuts down, it will shut down the registry as well.
Eugene.

Thanks, Eugene.
I also tried that, and encountered the same problem. I am using linux, maybe its just a linux-related problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: about rmiregistry