aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NX:RMI-How to keep the RMI factory service running always? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "NX:RMI-How to keep the RMI factory service running always?" Watch "NX:RMI-How to keep the RMI factory service running always?" New topic
Author

NX:RMI-How to keep the RMI factory service running always?

frank sun
Ranch Hand

Joined: Apr 11, 2003
Posts: 102
Hi,
According to the instruction (Hotel Room Booking), we should run a specified class and accept the parameter from the user(server|client|standalone), but how to keep the RMI factory service running always? and what's the right approach to stop the service?
Regards!
Frank.
frank sun
Ranch Hand

Joined: Apr 11, 2003
Posts: 102
Let me make it more clear:
the below is from the Sun instruction:
When you submit your assignment, each part (client and server) must be executable using a command of this exact form:
java -jar <path_and_filename> [<mode>]
Your programs must not require use of command line arguments other than the single mode flag, which must be supported. Your programs must not require use of command line property specifications. All configuration must be done via a GUI, and must be persistent between runs of the program. Such configuration information must be stored in a file called suncertify.properties which must be located in the current working directory.
The mode flag must be either "server", indicating the server program must run, "alone", indicating standalone mode, or left out entirely, in which case the network client and gui must run.
Please comment it.
Thanks!
Frank
Perry Board
Greenhorn

Joined: May 03, 2003
Posts: 29
I've been using (as others have suggested):
java.rmi.registry.LocateRegistry.createRegistry(1099);
Which starts the registry programmatically. It will shut down automatically when the server application exits.
My question, though, is what to do if the registry is already running? This call will throw an exception that the port is already in use. I haven't got the whole classpath thing figured out yet. If the registry is already running, I assumed I could just go ahead and bind my remote object, but I'm having trouble with the registry finding the stubs if it was started from a command line in a different working directory. Anyone know more about this?
 
Consider Paul's rocket mass heater.
 
subject: NX:RMI-How to keep the RMI factory service running always?