my dog learned polymorphism*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes RMI server stops 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 "RMI server stops" Watch "RMI server stops" New topic
Author

RMI server stops

Eric Hendriks
Greenhorn

Joined: Oct 28, 2008
Posts: 2
As I understand an RMI server should keep on running indefinately after it has started. In my code however, the application exits after a short time. Anyone has a clue on why this happens?

The following is a snippet from my code:

RemoteContractorAPI server =
ContractorAPIFactory.getContractorAPI(path);

RemoteContractorAPI stub =
(RemoteContractorAPI) UnicastRemoteObject.exportObject(server, 0);

Registry registry = LocateRegistry.createRegistry(port);
registry.rebind(REMOTE_CONTRACTOR_API, stub);

RemoteContractorAPI is an interface which extends my business logic interface and the Remote interface.
Liviu Carausu
Ranch Hand

Joined: Oct 07, 2004
Posts: 158
Hi Eric,
Is your main thread ending ?


Oracle Certified Master Java SE6 Developer(SCJD),
OCE JEE 6 JSP and Servlets Developer.
Alex Belisle Turcot
Ranch Hand

Joined: Apr 26, 2005
Posts: 516
Hi,

Maybe this can help:
RMI Timeout

Regards,
Alex
Eric Hendriks
Greenhorn

Joined: Oct 28, 2008
Posts: 2
Yes it's the main thread (and subsequently all other threads) that's ending. I thought the server would keep on running.
[ October 28, 2008: Message edited by: Eric Hendriks ]
Liviu Carausu
Ranch Hand

Joined: Oct 07, 2004
Posts: 158
Yes it's the main thread (and subsequently all other threads) that's ending. I thought the server would keep on running.

You should keep at least one not daemon thread alive. I did this by showing a server configuration window The AWT thread keeps the application alive. The RMI threads are all daemons and therefore will be finished when there is no not daemon thread alive.
Greetings,
Liviu
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RMI server stops