Java Reference
In-Depth Information
• The RMI API, which is used between the client and the server parts and for intraserver
communication between the
LaunchServlet
and the
ServerRepositoryImpl
discussed
in the next item.
•Finally, a home-grown
ServerDeploylet'
s little server (
ServerRepositoryImpl
), for
centralized deploylets server-side management. It is accessed only from server-side
objects (the
LaunchServlet
and
ServerDeploylet
s).
Therefore, in order to run this example on our environment, we need to accomplish these steps:
1.
Install our
LaunchServlet
, and launch our favorite servlet container. (See Chapter 5 for
J2EE deployment details.)
2.
Launch the
Rmiregistry
tool on the server platform. (Such a tool is shipped with any
JRE package, and is located in the same directory as the JVM executable.)
3.
Then, launch our
ServerRepositoryImpl
mini-server. Read the following note if it is
your first time with J2SE's RMI. At this point, the Web server is waiting for client
requests, and the mini-RMI server is waiting for
LaunchServlet
's requests.
4.
Open up a browser window that provides the intranet address where we registered our
servlet. In the provided example, pack the address as
“
http://localhost:8080/deploylet/server
”.
5.
Finally, inspect what is going on. Regarding the server, look at the
ServerRepositoryImpl
standard output, while you may open up the Java Plug-In con-
sole to see if everything is OK on the client side. (On Windows 9x machines, double-
click the Duke icon in the process tray)
Running this example needs some extra care, both for running Plug-In applets without security
restrictions (see what was said for the previous example) and for enabling RMI to locate the
remotely exposed classes stubs. In order to do the latter, you need to supply a correct value for
the
java.rmi.server.codebase
property. The easiest way is to provide the local file system
path to the
deploylet
package classes. In order to do so, launch the
ServerRepositoryImpl
class with the following command line:
java -Djava.rmi.server.codebase=file:///C:/
[classes]
/
➥
com.marinilli.b2.c7.deploylet.ServerRepositoryImpl
Adapted with the current path to the Java root classes directory on your hard disk (substitute it
in
[classes]
in the previous example). For more information about technical RMI details,
consult the JDK 1.3 documentation; for a general overview, see the related section of the java
Tutorial.
For brevity, we don't give advice on how to compile locally the provided code. The interested
reader will find all the source files (together with
rmic
's generated class stubs) in the example
pack.