8 Deploying a Sample Web Application to an Oracle WebLogic Cluster

In this example, you can deploy a sample application named dizzyworld.ear to the Managed Servers in the Dept1_Cluster1 cluster.


This chapter discusses how to deploy the sample application to a single cluster (Dept1_Cluster1). You can choose to deploy the whole application in a single cluster or its different tiers in multiple clusters. In addition, you can deploy a separate application to a separate cluster within the same domain, based on your specific deployment and management requirements.

This chapter discusses the following topics:

8.1 Downloading the dizzyworld.ear Application

To download and extract the sample application, do the following:

  1. Download the dizzyworld.ear file from the following URL:



    If this file is downloaded as dizzyworld.zip in your web browser, manually rename its file name to dizzyworld.ear.

  2. Copy the dizzyworld.ear file to a local directory in /u01/common/general.


    If you are deploying this sample application for testing purposes, you do not need to perform server migration.

8.2 Configuring WAR-Scoped Coherence Clusters

With this configuration, or if you want only one application to use Coherence caches, each deployed Web application becomes its own Coherence cluster. Caches will be visible to the individual modules only. For example, this could be a recommended deployment for a stand-alone WAR deployment or stand-alone EJB deployment.

If you are deploying multiple WAR files, note that this configuration produces the largest number of Coherence nodes in the cluster—one for each deployed WAR file that uses coherence.jar. It also results in the largest resource utilization of the three configurations—one copy of the Coherence classes are loaded for each deployed WAR. On the other hand, since each deployed Web application is its own cluster, Web applications are completely isolated from other potentially misbehaving Web applications.


A Web module within an EAR can have a module-scoped Coherence node but an EJB module within an EAR can only have an application-scoped Coherence node.

To Use Coherence Caches with WAR-Scoped Clusters

  1. Use the WebLogic Server Administration Console to deploy coherence.jar and active-cache.jar as shared libraries to all of the target servers where the application will be deployed. See "Install a Java EE Library" in the Oracle Fusion Middleware Oracle WebLogic Server Administration Console Help.

    As an alternative to the Administration Console, you can also deploy the JAR files on the command line. The following are sample deployment commands:

    java weblogic.Deployer -username <> -password <> -adminurl <> -deploy coherence.jar -name coherence -library -targets <>
    java weblogic.Deployer -username <> -password <> -adminurl <> -deploy active-cache.jar -name active-cache -library -targets <>
  2. Import coherence.jar and active-cache.jar as optional packages in the manifest.mf file of each module that will be using Coherence.

    As an alternative to using the manifest file, copy coherence.jar and active-cache.jar to each WAR file's WEB-INF/lib directory.

    Example 8-1 illustrates the contents of a sample manifest.mf file.

    Example 8-1 Referencing coherence and active-cache JAR Files in the manifest.mf File

    Manifest-Version: 1.0
    Extension-List: coherence active-cache
    coherence-Extension-Name: coherence
    active-cache-Extension-Name: active-cache
  3. (Optional) If you want to configure Coherence cluster properties, create a CoherenceClusterSystemResourceMBean and reference it as a coherence-cluster-ref element in weblogic.xml or weblogic-ejb-jar.xml file.

    Example 8-2 illustrates a sample configuration for WAR-scoped clusters in the weblogic.xml file. The myCoherenceCluster MBean is of type CoherenceClusterSystemResourceMBean.

    Example 8-2 coherence-cluster-ref Element for WAR-Scoped Clusters


8.3 Installing and Deploying an Enterprise Application

For this enterprise deployment topology, you must install and deploy the dizzyworld.ear web application to Managed Servers in Dept1_Cluster1. To do so, compete the following steps:

  1. Extract the dizzyworld.ear file to a local directory in /u01/common/general.

  2. Open the weblogic-application.xml (located at /u01/app/FMW_Product1/Oracle/Middleware/wlserver_10.3/server/lib/consoleapp/META-INF) in a text editor and enter your Oracle Coherence cluster name, as shown in the following example:


    Save the file after making changes.

  3. Rebuild the dizzyworld.ear application.

  4. Log in to the WebLogic Administration Console.

  5. If you have not already done so, in the Change Center of the Administration Console, click Lock & Edit.

  6. In the left pane of the console, select Deployments.

    The Summary of Deployments page is displayed.

  7. In the right pane, click Install.

    The Install Application Assistant page is displayed.

  8. Specify the path, where your dizzyworld.ear file is located, and click Next.

  9. Select Install this deployment as an application and click Next.

  10. Select Dept1_Cluster1, and then All servers in the cluster (Figure 8-1).

    Figure 8-1 Select Deployment Targets

    Description of Figure 8-1 follows
    Description of "Figure 8-1 Select Deployment Targets "

  11. Click Next.

  12. In the Optional Settings page, accept the default values, and Click Next.

  13. Review the configuration settings you have chosen, and select No, I will review the configuration later to immediately update the application's configuration after you install it. Then click Finish to complete the installation.

8.4 Starting the Web Application

To start the Web application:

  1. In the left pane of the Administration Console, select Deployments.

  2. In the right pane, select the check boxes next to dizzyworld.ear.

  3. Click Start and choose Servicing all requests to the Web application.

  4. Click Yes to confirm that you want to start the selected Web application.

8.5 Testing the Application

After starting the web application, test the application as follows:

  1. Add a few items to the shopping cart using the go shopping link.

  2. Verify that your shopping cart includes the items you selected. If the items are in your shopping cart, the application is working fine.