|
|
It is easier to use WebLogic Enterprise (WLE) RMI if you have already written classes in the Sun Microsystems JavaSoft reference implementation of RMI. This section explains how to convert Sun JavaSoft RMI classes to WebLogic RMI using the WebLogic RMI Hello World application as an example.
Suppose you have an RMI Hello World example written similar to those found in the Sun JavaSoft documentation distribution. To convert these files for use with WLE, you must do the following.
To convert the RMI Hello World example from Sun JavaSoft RMI to WLE RMI, you must first modify the Java source code files to adjust for the following major differences:
Step 1. Modify the Java source code files.
You need to modify the following Java source code files:
Note that the file Hello.java
, which contains the remote interface, is exactly the same in both the Sun JavaSoft Hello World RMI example and in WebLogic Enterprise RMI. Therefore, you do not need to make any changes to this Java source file-you can use it as is. You will need to recompile it, though, along with the other Java files.
Modify this file as follows:
HelloImpl.java - A Remote Object Implementation
For details, see Step 3. Write the source code for a remote object that implements the remote interface. in Developing RMI Applications in WLE.
The RMI client can be either an applet or a Java client similar to that shown in our WLE RMI Hello World example. To convert either type of client from Sun JavaSoft RMI to WLE RMI, you must modify the client file similar to the following to account for some basic differences:
For details, see the explanation of the code for the WLE Hello World RMI client in Step 4. Write the source code for a client that invokes methods on the remote object. in Developing RMI Applications in WLE.
Compile the Java source files including the remote object implementation source file (HelloImpl.java), the remote interface that it extends (Hello.java ), the RMI client (HelloClient.java or an applet file), along with any other associated Java files needed for the application.
For example, the following command compiles the Java source files in examples/hello and puts the resulting class files under a directory called classes .
javac -d classes examples/hello/*.java
For more information on using the javac compiler to generate WLE RMI classes, see Step 5. Compile the source code files to create the executable RMI classes. in Developing RMI Applications in WLE.
To create a proxy stub file for the client and skeleton file for the server, run the weblogic.rmic compiler on the fully-qualified package names of compiled class files that contain remote object implementations.
For the WLE RMI Hello World Example, you would run the weblogic.rmic compiler on the class file HelloImpl as follows:
java weblogic.rmic -d . examples.hello.HelloImpl
For more information about stubs and skeletons and about using the WebLogic RMI compiler to generate them, see Step 6. Run the WebLogic RMI compiler on the implementation class to generate stubs and skeletons. in Developing RMI Applications in WLE.
Once you have the WLE RMI class files, all that is left to do is create a bootstrapping mechanism for your application and package the application into a JAR file. For information on how to do this, see the topic Building Your RMI Application in the WLE Environment.
|
Copyright © 1999 BEA Systems, Inc. All rights reserved.
|