Configuring |
Documentation Contents |
On the Solaris Operating System (Solaris OS), the Internet
services daemon inetd
provides an
alternative to starting up services at system boot time. This
daemon, a server process for Internet standard services,
can be configured to start services on demand. For details on
the Internet services daemon, see the Solaris OS
inetd(1M)
man page.
As of the J2SE(tm) 5.0 release, inetd
can be
configured to start the Java RMI activation daemon
rmid
on demand. In this case, rmid
does not need to be started up at boot time or started up
manually. Instead, rmid
will be started when a
client attempts to connect to it, such as in order to activate an
object.
Note: If restartable services are registered with
rmid
, rmid
should be started at system
boot type (not by inetd
) so that the restartable
services are always running when the system is up.
To configure inetd
to launch
rmid
, you will need to add an entry to each of two
configuration files that inetd
uses,
/etc/inetd.conf
and /etc/services
.
Editing these files requires root access to the machine that
rmid
will run on.
After inetd
has been reconfigured, you should
test your configuration to make sure that it works properly.
This tutorial has the following steps:
- Configure
/etc/inetd.conf
- Configure
/etc/services
- Force
inetd
to read its new configuration- Test your configuration
/etc/inetd.conf
The
/etc/inetd.conf
configuration file contains entries for the services to be launched wheninetd
receives a request over a socket. For details on the format of this configuration file see the Solaris OSinetd.conf(4)
man page.To configure
inetd
to launchrmid
, add the following entry to the/etc/inetd.conf
configuration file (requires root access to the machine):where jreHome is a path to the installed JRE, logDir is the directory for the log file, and rmidOptions is any other options forrmid stream tcp wait nobody jreHome/bin/rmid \ rmid -log logDir/rmid.log rmidOptionsrmid
(for example, property initializations). Whenrmid
is launched byinetd
the-log
option must be specified, and the-port
option must not be specified, since the port is derived from the/etc/services
configuration.If
rmid
needs to be run as a user other thannobody
, replacenobody
above with the user ID under whichrmid
should run.
/etc/services
Next,
rmid
needs to be listed as a service in the/etc/services
configuration file. For details on the format of this configuration file see the Solaris OSservices(4)
man page.To list
rmid
as a service, add the following entry to the/etc/services
configuration file (requires root access to the machine):where port is the port number for thermid port/tcpActivationSystem
and theActivator
remote objects thatrmid
exports. This port number is typically 1098, but another port number can be used as long as the clients and activatable services define the system propertyjava.rmi.activation.port
to that port.
inetd
to read its new configurationNow that the configuration has been modified,
inetd
needs to read the new configuration so that it can listen on the appropriate ports for the services that are configured.But first, it is important to make sure that
rmid
is not already running. To do this, run the following command:If the above command does not print out the information for a running% ps -ef | grep rmidrmid
process, thenrmid
is not running. If it does, then you will need to shut downrmid
first before continuing.Next,
inetd
needs to read its new configuration. To forceinetd
to reread its configuration, the runninginetd
process must be sent a hangup signal. First, find the process ID for the runninginetd
process by running the following command:which will print out something like this:% ps -ef | grep inetdIn this example, the process ID forroot 171 1 0 Sep 30 ? 0:02 /usr/sbin/inetd -sinetd
is171
. Now, theinetd
process can be sent a hangup signal by running the following command and supplying the process ID (requires root access):Now,% kill -HUP 171inetd
is all set to launchrmid
when a program attempts to connect to the port configured above.
To test that
inetd
is configured properly, you can run a simple program that looks up theActivationSystem
which will, in turn, causeinetd
to launchrmid
if the configuration is correct.The following is a simple program to look up the
ActivationSystem
on a port, supplied as the value of thejava.rmi.activation.port
system property:package example.inetd; import java.rmi.activation.ActivationSystem; import java.rmi.activation.ActivationGroup; public class GetActivationSystem { public static void main(String[] args) throws Exception { ActivationSystem system = ActivationGroup.getSystem(); System.err.println("ActivationSystem = " + system); } }Compile and run this program as follows:
where classDir is the class path for this example class, and port is the port for the% javac -d classDir GetActivationSystem.java % java -classpath classDir -Djava.rmi.activation.port=port example.inetd.GetActivationSystemActivationSystem
configured forrmid
in the/etc/services
file.If the program prints out the
ActivationSystem
successfully thenrmid
was launched byinetd
.If the program either hangs or prints an exception trace, check the output file produced by
rmid
. Whenrmid
is launched byinetd
, any output written toSystem.err
is written to a file located in the directory specified by the propertyjava.io.tmpdir
, typically/var/tmp
on the Solaris OS. The output file is prefixed with "rmid-err" and has the suffix of ".tmp". The file name also contains other characters (typically numbers) in between to keep the file name unique.If
rmid
starts up successfully frominetd
, the output file should contain text similar to the following (with no warning or error messages):If the file does not exist, the above text is not in the file, or additional error output is in the file, then recheck the configuration. Upon changing theTue Sep 30 13:07:38 EDT 2003 rmid startup with inherited channel: sun.nio.ch.ServerSocketChannelImpl[/129.148.70.120:1098]inetd
configuration, remember to sendinetd
a hangup signal so that it rereads its altered configuration, and remember to terminate anyrmid
process started from the previous attempt before continuing.
Copyright © 2006
Sun Microsystems, Inc. All Rights Reserved. Please send comments to: rmi-comments@java.sun.com |
Java Software |