• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about rmiregistry

 
Holmes Wong
Ranch Hand
Posts: 163
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 275
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 163
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2937
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 163
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic