|
|
|
|
However, before we can actually perform a remote method invocation, we have one more thing to accomplish:
The RMI library provides a bootstrap registry service through which the remote object may register itself, and then subsequently be located. There are a number of different ways in which the registry may be accessed. We'll see some of them as we go through the examples. The RMI Registry must be up and running before the server/remote object can start up and register itself, and before the client can locate the remote object. The JDK supplies a utility, rmiregistry which must be run to start the service -- that is, it must be run before you can perform any remote method invocations. Click here for a synopsis of the rmiregistry command.
(Naturally, the above commands assume that the rmiregistry executable directory location is included in the PATH.) The default port number used by the RMI Registry is 1099, but you can override that (for example, if that port is already in use) by specifying the port number explicitly. Note: A peculiar restriction appears to be the case for rmiregistry:
If you fail to do this, your server will fail in its startup, with a mysterious error about not being able to find the remote interface. There is a reason for this strange behavior; see http://java.sun.com/j2se/1.5.0/docs/guide/rmi/codebase.html . |
| The page was last updated February 19, 2008 |