Generating Stubs and Skeletons Using rmic


Generating Stubs and Skeletons Using rmic

As shown in Figure 12.1, the RMI architecture uses stubs and skeletons as the layer directly below the client and server, respectively. The stubs and skeletons are automatically generated by the RMI compiler, rmic . After the remote interface and remote object are compiled, you must generate the stub and skeleton classes. These classes perform the communication and data marshalling between the client and remote object. The stub is used by the client, and the skeleton is used by the remote object. These classes are generated by the rmic . The command-line argument to rmic is the full package and class name of the compiled RMI server. The RMI compiler uses the same command-line argument as javac to create directories for the package name. If you are not using package names , you do not need to use the -d option. The stub and skeleton are automatically placed in the same package as the remote object implementation class. The stub and skeleton must be in the CLASSPATH for the client and the remote object.

The RMI compiler from JavaSoft is a standalone executable. The RMI compiler from Weblogic is a Java class that is run using Java. Both perform the same function, to create the stubs and skeletons.

Java 2 Standard Edition rmic

The RMI compiler released with J2SE is the rmic executable. The command line is the class name of the RMI server. For example, if the package name is com.mycompany.j2ee and the implementation class for the remote object is MyRmiImpl , the rmic command is

 
 rmic -d . com.mycompany.j2ee.MyRmiImpl 

The classes that the rmic will generate are the two compiled class files:

 
 com\mycompany\j2ee\MyRmiImpl_Stub.class com\mycompany\j2ee\MyRmiImpl_Skel.class 

WebLogic rmic

The WebLogic RMI compiler is a Java class named weblogic.rmic . Like the JavaSoft rmic , the full package and class name of the compiled RMI server is taken as a command-line argument. The -d command-line argument is also used to build the directory structure for the package name of the stubs and skeletons. Using the same example RMI server from the previous section, the command line for the WebLogic RMI compiler is:

 
 java weblogic.rmic -d . com.mycompany.j2ee.MyRmiImpl 

The classes that the rmic will generate are the two compiled class files:

 
 com\mycompany\j2ee\MyRmiImpl_WLStub.class com\mycompany\j2ee\MyRmiImpl_WLSkel.class 

The WebLogic RMI compiler has a keepgenerated command-line option that will save the Java source files for the generated stub and skeleton for your viewing pleasure .



BEA WebLogic Platform 7
BEA WebLogic Platform 7
ISBN: 0789727129
EAN: 2147483647
Year: 2003
Pages: 360

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net