This blog discusses how to deploy a sample application provided by Oracle to a single Weblogic cluster. 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 blog will detail the following:
- Downloading the sample application provided by Oracle: “dizzyworld.ear”
- Configuring WAR-scoped Coherence Clusters
- Installing and Deploying the Enterprise Application
- Starting the Web Application
- Testing the Web Application
Downloading the sample application provided by Oracle: “dizzyworld.ear”
To download and extract the sample application, do the following:
- Download the dizzyworld.ear file from the following URL:
Note: If this file is downloaded as dizzyworld.zip in your web browser, manually rename its file name to dizzyworld.ear.
- Copy the ear file to a local directory in /u01/common/general.
Note: If you are deploying this sample application for testing purposes, you do not need to perform server migration.
Configuring WAR-Scoped Coherence Clusters
With this configuration, you will configure 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 where one copy of the Coherence classes is 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.
Note: 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
- Use the WebLogic Server Administration Console to deploy jar and active-cache.jar as shared libraries to all of the target servers within the cluster where the application will be deployed.
As an alternative to the Administration Console, you can also deploy the JAR files using 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 <>
- Import coherence.jar and active-cache.jar as optional packages in the manifest.mf file of each module that will be using Coherence. The below screen shot is a sample of manifest.mf
As an alternative to using the manifest file, copy coherence.jar and active-cache.jar to each WAR file’s WEB-INF/lib directory.
- (Optional) If you want to configure Coherence cluster properties, create a CoherenceClusterSystemResourceMBean and reference it as a coherence-cluster-ref element in xml or weblogic-ejb-jar.xml file.
The below example illustrates a sample configuration for WAR-scoped clusters in the weblogic.xml file. The myCoherenceCluster MBean is of type CoherenceClusterSystemResourceMBean.
Installing and Deploying the Enterprise Application
For this enterprise deployment topology, you must install and deploy the dizzyworld.ear web application to Managed Servers in your cluster. To do so, complete the following steps:
- Extract the ear file to a local directory in /u01/common/general.
- 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.
- Rebuild the ear application.
- Log in to the WebLogic Administration Console.
- If you have not already done so, in the Change Center of the Administration Console, click Lock & Edit.
- In the left pane of the console, select Deployments. The Summary of Deployments page is displayed.
- In the right pane, click Install. The Install Application Assistant page is displayed.
- Specify the path, where your ear file is located, and click Next
- Select Install this deployment as an application and click Next
- Select <your_cluster>, and then All servers in the cluster as shown in the screen shot in the following page.
- Click Next.
- In the Optional Settings page, accept the default values, and click Next
- 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.
- Click Finish to complete the installation.
Starting the Web Application
To start the Web application:
- In the left pane of the Administration Console, select Deployments.
- In the right pane, select the check boxes next to ear.
- Click Start and choose “Servicing all requests” to the Web application.
- Click “Yes” to confirm that you want to start the selected Web application.
Note: Once the application is in Active state, then you can move on to testing the application, otherwise check your log files for any errors during the deployment, fix them and start the application again.
Testing the Application
After starting the web application, test the application as follows:
- Access the application through its URL: http://<hostname.domain>:<port>/dizzyworld
- Add a few items to the shopping cart using the go shopping link.
- Verify that your shopping cart includes the items you selected. If the items are in your shopping cart, the application is working fine.