|
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
inetdto read its new configuration- Test your configuration
/etc/inetd.confThe
/etc/inetd.confconfiguration file contains entries for the services to be launched wheninetdreceives a request over a socket. For details on the format of this configuration file see the Solaris OSinetd.conf(4)man page.To configure
inetdto launchrmid, add the following entry to the/etc/inetd.confconfiguration 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). Whenrmidis launched byinetdthe-logoption must be specified, and the-portoption must not be specified, since the port is derived from the/etc/servicesconfiguration.If
rmidneeds to be run as a user other thannobody, replacenobodyabove with the user ID under whichrmidshould run.
/etc/servicesNext,
rmidneeds to be listed as a service in the/etc/servicesconfiguration file. For details on the format of this configuration file see the Solaris OSservices(4)man page.To list
rmidas a service, add the following entry to the/etc/servicesconfiguration file (requires root access to the machine):where port is the port number for thermid port/tcpActivationSystemand theActivatorremote objects thatrmidexports. 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.portto that port.
inetd to read its new configurationNow that the configuration has been modified,
inetdneeds 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
rmidis 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 rmidrmidprocess, thenrmidis not running. If it does, then you will need to shut downrmidfirst before continuing.Next,
inetdneeds to read its new configuration. To forceinetdto reread its configuration, the runninginetdprocess must be sent a hangup signal. First, find the process ID for the runninginetdprocess 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 -sinetdis171. Now, theinetdprocess can be sent a hangup signal by running the following command and supplying the process ID (requires root access):Now,% kill -HUP 171inetdis all set to launchrmidwhen a program attempts to connect to the port configured above.
To test that
inetdis configured properly, you can run a simple program that looks up theActivationSystemwhich will, in turn, causeinetdto launchrmidif the configuration is correct.The following is a simple program to look up the
ActivationSystemon a port, supplied as the value of thejava.rmi.activation.portsystem 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.GetActivationSystemActivationSystemconfigured forrmidin the/etc/servicesfile.If the program prints out the
ActivationSystemsuccessfully thenrmidwas launched byinetd.If the program either hangs or prints an exception trace, check the output file produced by
rmid. Whenrmidis launched byinetd, any output written toSystem.erris written to a file located in the directory specified by the propertyjava.io.tmpdir, typically/var/tmpon 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
rmidstarts 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]inetdconfiguration, remember to sendinetda hangup signal so that it rereads its altered configuration, and remember to terminate anyrmidprocess 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 |