WebLogic Server 6.0 Code Examples, BEA Systems, Inc.

Package examples.cluster.rmi

This simple RMI example is generated with the -clusterable flag and is registered as a startup class in the per-cluster properties file, which binds the impl into the cluster-wide, replicated naming tree.

See:
          Description

Interface Summary
HelloCluster This interface is the remote interface for the weblogic.rmi.
 

Class Summary
HelloClusterClient Client for simple clustered RMI service example.
HelloClusterImpl This class implements the interface HelloCluster.
 

Package examples.cluster.rmi Description

This simple RMI example is generated with the -clusterable flag and is registered as a startup class in the per-cluster properties file, which binds the impl into the cluster-wide, replicated naming tree. The stub that a HelloClient receives can failover and load balance in a cluster.

Note: You'll need a cluster license in order to run this example in a cluster environment. Contact your sales rep for more information.

There isn't anything particularly different about this example from any other RMI example -- which is important to point out -- except in its generation. Note that you add the -clusterable flag to generate a cluster-aware stub.

You can also set up this example so that it operates as a "pinned" RMI object. In this case, leave off the -clusterable flag when you run RMIC, and register the startup class in the per-server properties file for the server where you want the service to be bound. In this case, the service itself will be available from any server in the cluster since all the cluster servers know how to return the unreplicated stub, but if the particular server that hosts the pinned service fails, the service itself will not failover.

These three sections cover what to do:

  1. Build the Example
  2. Configure the Server
  3. Run the Example

Build the Example

  1. Set up your development shell as described in Setting up your environment.
  2. Move to the /samples/examples/cluster/rmi subdirectory:
    $ cd %WL_HOME%\samples\examples\cluster\rmi
  3. Compile the files in this directory using the supplied build script:
     $ build

    The build script compiles the sample .java files and uses weblogic.rmic to generate the clustered stub. The final classes are placed in %WL_HOME%/config/examples/serverclasses.

Configure the Server

  1. Configure a WebLogic Server cluster within the Examples domain, if you have not already done so.
  2. Start the clustered servers using the Examples configuration. You may want make a copy of the provided StartExamplesServer script for each server in your cluster, and edit each copy to boot an individual server.
  3. Bring up the Administration Console in your browser.
  4. Click to expand the Startup & Shutdown node in the left-hand pane.
  5. Select the hello_cluster node. The hello_cluster configuration displays in the right-hand pane.
  6. Select the Targets tab to display the Available and Chosen targets.
  7. Deploy hello_cluster on your configured cluster.

Run the Example

  1. Start the clustered servers using the Examples configuration, if you have not already sone so.
  2. In a separate command-line window, set up your development shell as described in Setting up your environment.
  3. Run the client by entering on a single line:
    $ java examples.cluster.rmi.HelloClusterClient -url t3://any cluster node:7001

    where parameters are:

There's More...


Documentation is available at
http://e-docs.bea.com/wls/docs60

Copyright © 2000 BEA Systems, Inc. All Rights Reserved.