11/15

# 5 Using Coherence*Web on WebLogic Portal

Coherence*Web can be used in a WebLogic Portal environment to provide session state management based on Coherence. Coherence*Web allows for more advanced deployment models, session models, and locking modes in a clustered environment. For more information on these features, see Chapter 4, "Coherence*Web Session Management Features."

## 5.1 Using Coherence*Web with WebLogic Portal—Main Steps

Follow these steps to use Coherence*Web with WebLogic Portal.

1. Download Any Required Patch (optional)

2. Modify the Session Configuration (optional)

3. Start a Cache Server

4. Locate the Coherence JAR File

5. Enable a P13N (Personalization) Cache Provider (optional)

6. Reference the SPI in the Portal Application

7. Enable Coherence*Web Sessions

8. Create and Deploy the Application

### 5.1.1 Download Any Required Patch (optional)

Note:

WebLogic Server versions 10.3.1 or later do not require a patch. If you are using version 10.3.1 or later, you can skip this step.

If you are using WebLogic Server 10.3 or earlier, apply the WebLogic Server publicly available patch to all WebLogic Server instances that are hosting the Web applications that will use Coherence*Web. Table 5-1 lists the appropriate patches for your version of WebLogic Server and Coherence release level.

Table 5-1 Required WebLogic Server and Coherence Patch Release Levels

| WebLogic Server 9.2 MP1 | WebLogic Server 10.3 | WebLogic Server 10.3.1 and later
--- | --- | --- | ---
WebLogic Smart Update | Patch ID: AJQB | Patch ID: 6W2W | No patch required.

The patches can be downloaded by using either the MetaLink Web site or the WebLogic Server's Smart Update utility.

To Download from MetaLink:

1. Go to the Metalink Web site to manually locate the patch.

   `http://metalink.oracle.com/`

2. Select the Patches tab and click the Simple Search link. On the subsequent screen, submit a search for a Patch Number/Name with the appropriate value (for example, `11399293`).

3. Download the patch zip file from the displayed results.

4. See the `README.txt` included in the patch zip file for instructions for applying the Coherence patch.

To Download with Smart Update:

1. Review the instructions in the Smart Update Guide for using Smart Update to install WebLogic Server patches.

   For production environments, Oracle recommended that you review the Smart Update production installation.

   You can find the Smart Update Guide at this URL.

   `https://download.oracle.com/docs/cd/E14759_01/doc.32/e14143/toc.htm`

2. Select Start then All Programs then Oracle WebLogic then Smart Update to open the log-in dialog box. Use your Support ID and Password to log in.

   Figure 5-1 Oracle Smart Update Login Dialog Box

   Description of "Figure 5-1 Oracle Smart Update Login Dialog Box"

3. Download and apply the appropriate patch for your version of the WebLogic Server. Figure 5-2 illustrates the Oracle Smart Update browser.

   Figure 5-2 Oracle Smart Update Browser

   Description of "Figure 5-2 Oracle Smart Update Browser"

### 5.1.2 Modify the Session Configuration (optional)

Modify the `session-cache-config.xml` file (if necessary) to customize the Cache topology for Coherence*Web.

This configuration file is located in the `/WEB-INF/classes` directory within the `coherence-web-spi.war` file. If you modify session-cache-config.xml, then it should be updated in the WAR file.

See Appendix C, "Session Cache Configuration File" for a description of the default configuration of the `session-cache-config.xml` file.

### 5.1.3 Start a Cache Server

A Cache Server JVM is a dedicated Coherence JVM that is responsible for storing and managing all cached data (in this case, HttpSession state). One or more Cache Server JVMs must be started before the WebLogic Server or WebLogic Portal JVMs can be started.

1. Create a script for starting a Cache Server JVM. The following is a very simple example of a script that starts a storage-enabled Cache Server for use with Coherence*Web. This example assumes that you are using a Sun JVM. See "JVM Tuning" in the Developer's Guide for Oracle Coherence for more information on tuning your particular JVM.

       java -server -Xms512m -Xmx512m -cp <Coherence installation dir>/lib/coherence.jar:<Coherence installation dir>/lib/coherence-web-spi.war -Dtangosol.coherence.management.remote=true -Dtangosol.coherence.cacheconfig=WEB-INF/classes/session-cache-config.xml -Dtangosol.coherence.session.localstorage=true com.tangosol.net.DefaultCacheServer

2. Start one or more Cache Server JVMs using the script described above.

### 5.1.4 Locate the Coherence JAR File

Copy the `coherence.jar` into the `APP-INF\lib` directory of the portal enterprise application.

### 5.1.5 Enable a P13N (Personalization) Cache Provider (optional)

If you want to use the Coherence P13N (Personalization) `CacheProvider`, then copy the `coherence-wlp.jar` into the `APP-INF\lib` of the portal enterprise application.

See the Integration Guide for Oracle Coherence for more information on the P13N CacheProvider SPI implementation and WSRP-federated portals.

If you want to use the Coherence P13N Cache as the default cache provider, add the following line before the first `<cache>` element to the `META-INF\p13n-cache-config.xml` file in the portal enterprise application:

    <default-provider-id>com.tangosol.coherence.weblogic</default-provider-id>

### 5.1.6 Reference the SPI in the Portal Application

Reference `coherence-web-spi.war` by using a library-reference in the `WEB-INF\weblogic.xml` file in the portal Web application:

          <wls:library-ref>
              <wls:library-name>coherence-web-spi</wls:library-name>
          </wls:library-ref>

### 5.1.7 Enable Coherence*Web Sessions

To enable Coherence*Web sessions, set the application parameter `coherence-web-sessions-enabled` to `true` in the `WEB-INF\web.xml` file in the portal Web application:

          <context-param>
              <param-name>coherence-web-sessions-enabled</param-name>
              <param-value>true</param-value>
          </context-param>

### 5.1.8 Create and Deploy the Application

1. Create an EAR file for the test application using workshop's EAR deployment. This EAR will be deployed to the cluster for testing.

2. In the portal domain, first deploy `coherence-web-spi.war` as a library to the cluster.

3. In the portal domain, deploy the application EAR to the cluster.