By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,854 Members | 876 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,854 IT Pros & Developers. It's quick & easy.

Creating a long-running RMI server

P: n/a
I want to create a long-running RMI server, which makes an object
available to remote hosts, and does nothing else. However, the server
consistently exists with no exception or error after >=60 seconds.
Without waiting on a dummy object or going into a sleep loop, how can I
prevent my server from exiting?

Here's my code:
public interface RemoteInterface extends java.rmi.Remote
public String doRequest() throws java.rmi.RemoteException;
import java.rmi.*;
import java.rmi.server.*;

public class RMIServer extends UnicastRemoteObject implements
public RMIServer() throws RemoteException

public String doRequest()
return "done";

public static void main(String[] args)
try {
// create a remote object and register it
RMIServer obj = new RMIServer();
Naming.rebind("rmi://localhost:1099/object", obj);

// throws if the URL to the rmiregistry is invalid
catch ( e) {
System.err.println("Malformed URL: " + e);
catch (RemoteException e) {
System.err.println("RMI error: " + e);

I've tested this with Sun's Java 1.5 and 1.4.2 SDKs, with the same

Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.