|
|
This example provides a distributed version of the classic Hello World program using remote method invocation (RMI) in a WebLogic Enterprise environment.
This topic includes the following sections:
In addition to the fully supported examples supplied on the CD-ROM with this release of WebLogic Enterprise (WLE), the BEA WLE team provides several unsupported code examples on a password protected Web site for WLE customers. You can get all the files for the WLE RMI Hello World example from this Web site. The URL for the unsupported samples WLE Web site is specified in the product Release Notes under "About This BEA WLE Release" in the subsection "Unsupported Samples and Tools Web Page." On the samples Web page, the RMI HelloWorld example is in a directory similar to the following:
/unsupported/samples/rmi/helloworld The WLE RMI Hello World example is a simple application for demonstrating remote method invocations in a distributed WebLogic Enterprise environment. The example shows a client making a remote method call to a server object running on the host. When you run the client at the command line, "Hello World!" is displayed in response.
To run the WLE RMI Hello World example, you need WLE installed on your system and the appropriate environment variables set. The Hello World example does some automated environment setup for you, so for now the only variables you should need to check are these:
Where can I find the RMI Hello World example?
What is the RMI Hello World Example and what do I need to run it?
Required Software and Environment
For complete information on how to verify these settings, see the topic Setting Up Your WLE Development Environment.
The files needed for this example are supplied on the BEA WebLogic Enterprise unsupported samples Web Site. You can get the URL for this Web site, and other related information about it, from the product Release Notes.
The files included are shown in the following table.
Hello World Files
File |
Description |
---|---|
A remote object implementation that implements examples.hello.Hello
|
|
Registers the RMI implementation with the WLE server at startup
|
|
We suggest that first you just find the Hello World RMI example (on the Web site indicated in the product Release Notes), build it, and run it. This is an easy way to get familiar with WebLogic RMI on IIOP.
To build and run the Hello World example do the following:
Building and Running the Hello World Example
The Hello World example script automatically sets the TUXCONFIG environment variable for you, so you do not need to set this variable now. The TUXCONFIG variable indicates the location of the TUXCONFIG file for the WLE application you want to run, in this case our Hello World example application. The script also adds the HelloWorld application classes to your CLASSPATH, and the required paths for TUXDIR and the JDK bin to your PATH.
The URL for the unsupported samples WLE Web site is specified in the product Release Notes under "About This BEA WLE Release" in the subsection "Unsupported WLE Samples and Tools on BEA Web Site." On the samples Web page, the RMI HelloWorld example is in a directory similar to the following:
/unsupported/samples/rmi/helloworld
runme
Running this script compiles, builds, and runs the RMI Hello World example. You should see output similar to the following, as a result of running the runme script.
C:\myWLEapps\rmi\helloworld>runme
Setting up for RMI HelloWorld sample.
--- Verifying some variables...
--- Creating setenv.cmd...
--- Creating ubbconfig...
--- Creating run_client.cmd...
--- Compiling Java sources...
--- Generating Stub and Skeleton...
--- Building the Jar...
--- Creating tuxconfig...
--- Booting WLE...
Booting all admin and server processes in C:\myWLEapps\rmi\helloworld\tuxconfig
INFO: BEA Engine, Version 2.4
INFO: Serial #: 123456789, Expiration 2000-06-21, Maxusers 200
INFO: Licensed to: Samantha Stevens
Booting admin processes ...
exec BBL -A :
process id=271 ... Started.
Booting server processes ...
exec TMSYSEVT -A :
process id=239 ... Started.
exec TMFFNAME -A -- -N -M :
process id=240 ... Started.
exec TMFFNAME -A -- -N :
process id=243 ... Started.
exec TMFFNAME -A -- -F :
process id=284 ... Started.
exec JavaServer -A :
process id=225 ... Started.
exec ISL -A -- -n //SAMS:2468 :
process id=274 ... Started.
7 processes started.
--- Running the RMI Client... (Should say "Hello World!")...
Hello World!
--- Shutting down WLE...
Shutting down all admin and server processes in C:\myWLEapps\rmi\helloworld
Shutting down server processes ...
Server Id = 5 Group Id = GROUP1 Machine = simple: shutdown succeeded
Server Id = 6 Group Id = GROUP2 Machine = simple: shutdown succeeded
Server Id = 4 Group Id = GROUP1 Machine = simple: shutdown succeeded
Server Id = 3 Group Id = GROUP1 Machine = simple: shutdown succeeded
Server Id = 2 Group Id = GROUP1 Machine = simple: shutdown succeeded
Server Id = 1 Group Id = GROUP1 Machine = simple: shutdown succeeded
Shutting down admin processes ...
Server Id = 0 Group Id = simple Machine = simple: shutdown succeeded
7 processes stopped.
--- Finished.
C:\rmiHelloExample\helloworld>
Some of the tasks performed by the script are:
Notice also that as a result of running the runme script, you get several new files. Some of the more interesting ones are shown in the following table.
Generated File(s) |
Description |
---|---|
RMI stub and skeleton classes in classes/examples/helloworld/
|
|
Windows (DOS) and UNIX commands to run the client with appropriate arguments.
|
For more information about these files, refer to Developing RMI Applications in WLE.
If you want to start over, you can quickly remove all generated files from the example directory by running the following command in the helloworld
directory:
clobber Running the clobber
command removes all generated files for the Hello World example, leaving only the original exampe files: the Java source files, server.xml
file, and the runme
commands for Windows and UNIX.
After you successfully run the the RMI Hello World example, you can walk through the process used to create it by referring to Developing RMI Applications in WLE. This topic steps through the entire development and runtime process using the Hello World files as an example.
Each of the key Java source code files is explained in detail in the following subtopics:
Cleaning up the Directory
Understanding the Hello World Example
|
Copyright © 1999 BEA Systems, Inc. All rights reserved.
|