Noel Enete
Start Jini


Jini's Lookup Service should be started before running any of the examples.

Note: If you are running on a computer that was not connected to a network when it was booted, there is a particularly annoying bug (feature?) of RMI under Windows for which you must compensate1 or you will get an ActivationException when starting reggie.

SetInstallPoint


To start the Jini LookupService first edit the SetInstallPoint script file:

  • Open a commandline and change to the directory \java \nuggets \pages \examples \StartJini (remove the spaces from the path).
  • Edit the script file SetInstallPoint (for Linux) and SetInstallPoint.bat (for NT) and change them to reflect your environment.
  • The first variable, RUNTIME_JAR makes up for an unfortunate deficiency in the rmic compiler. When you use the -classpath option with the rmic compiler, you need to specify the location of the rt.jar (Run Time Jar). Otherwise, it will not find all the packages. The javac compiler does not need this file specified in the command line classpath and the rmic compiler should work the same way, but it doesn't. Find where the Java install program placed your runtime jar file and specify that location in the RUNTIME_JAR variable.
  • If you installed Java, Jini and the Nuggets in the recommended directories, you won't need to tailor any of the other variables.



Figure 1: Set Install Point


Launch Programs


Start the RMI daemon:

  • Open a commandline and change to the directory \java \nuggets \pages \examples \StartJini (remove the spaces from the path).
  • Start the RMI daemon by executing the r1 script file.

...and the Lookup Service's Web Server:

  • Open a commandline and change to the same directory \java \nuggets \pages \examples \StartJini (remove the spaces from the path).
  • Start the Jini lookup service's web server by executing the r2 script file.

...and the Lookup Service (called reggie):

  • Open a commandline and change to the same directory \java \nuggets \pages \examples \StartJini (remove the spaces from the path).
  • Start the Jini lookup service (reggie) by executing the r3 script file. This takes between 30 secs and 2 minutes to complete depending on how fast your computer is. It installs itself in RMI's activation feature, then it frees up the command line. Wait for this to complete before going on.








Figure 2: Jini Launch Scripts


...and a poor man's Jini Browser:

  • Open a commandline and change to the same directory \java \nuggets \pages \examples \StartJini (remove the spaces from the path).
  • Start the Jini browser by executing the r4 script file. This runs forever and lists the current services that are registered in the lookup server.
  • If all goes well, this browser will have fetched the reggie-dl.jar file from the web server. Check the output from r3 to verify this fetch.




Figure 3: Poor Man's Browser Output


________________


(1) It seems that as RMI comes up, it calls the IP stack to perform some initialization. But, if there is no network cable plugged into the computer when Windows/NT is booted, Windows does not load the IP stack into memory. So there is an indefinite hang when loading the RMID daemon (in the r1 script file mentioned above). This error does not become visible until the r2 script file is launched and reggie tries to load. At that time, an ActivationException is thrown.

To make RMI happy, you have to find and edit your hosts file (usually in the C:\WINNT\system32\drivers\etc directory). You must append a line to the file that contains the IP address your computer uses when attached to a network (even if you use DHCP) followed by your host name. For example, my host file looks like this:

# Copyright (c) 1993-1995 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows NT.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost
10.4.101.227    pc-sn709199     pc-sn709199.mydomain.com


The last line indicates that my computer uses the IP address 10.4.101.227 when it is connected to the network and the host name for my computer is pc-sn709199 (we have very creative admin folks) and the complete hostname.domainname is pc-sn709199.mydomain.com.

To get your host name, go to the command line and type hostname. To get your IP address, type netstat -nr on the commandline while your computer is connected to a network. Your address is the address that occurs most often in the Interface column.

With these changes in place, when RMI attempts to contact the host by host name, it will fail to find the domain name server, but will be able to resolve the name from your hosts file, and RMI will come all the way up, and reggie will come up, and you are ready for action.



by Noel Enete . . . www.enete.com . . . noel@enete.com