Oracle WebLogic Server 12c: Configuring and Using Production Redeployment

Purpose

This tutorial shows how to use the Oracle WebLogic Server 12c production redeployment feature to have two versions of the same application deployed simultaneously.

Time to Complete

Approximately 20 minutes

Overview

WebLogic's production redeployment strategy involves deploying an updated version of an application alongside an older version of that same application. WebLogic Server automatically manages client connections so that only new client requests are directed to the new version of the application. Clients already connected to the application (clients that already have an HTTP Session object) during the redeployment continue to use the older version of the application until they complete their work, at which point WebLogic Server automatically retires the older application.

To assign a version identifier to an application, you can add a line that gives the version name to the MANIFEST.MF file, which is part of the enterprise or web application being deployed. Alternatively, the version name can be specified at deployment time by using the -appversion argument of the weblogic.Deployer command-line tool, or the archiveVersion argument of the WLST commands deploy() and updateApplication().

This tutorial covers deploying versioned applications that use the version name in the MANIFEST.MF file.

Software Requirements

The following is a list of software requirements:

Prerequisites

Before starting this tutorial, you should have completed the Oracle by Example tutorials titled Oracle WebLogic Server 12c: Installing WebLogic Server and Creating a Domain and Oracle WebLogic Server 12c: Configuring Managed Servers.

Deploying the First Version of the Application

To deploy the first version of the application, perform the following steps:

1.

Download the versioned.zip file to the machine where your WebLogic Server domain and servers are. Extract the file contents to a local drive. In this tutorial, the files are extracted into the /home/oracle/versioned directory. The zip file contains two directories:

  • deployversion1 - which contains the first version of the simple.war application.
  • deployversion2 - which contains the second version of the simple.war application.

 

2.

If you wish to see what the version information in the META-INF/MANIFEST.MF file looks like, you can extract the files from simple.war and use a text editor to view that file. Here is the MANIFEST.MF file from the deployversion1/simple.war file:

Show Screenshot for Step

 

Notice the entry Weblogic-Application-Version: v1, which sets the version name to v1.

The MANIFEST.MF file from the deployversion2/simple.war file has a different version name for the Weblogic-Application-Version attribute: v2.

 

3.

If the administration server of the domain is not already running, it must be started. To start it, in a Terminal window, navigate to the domain directory, and enter the command:

$ ./startWebLogic.sh

Show Screenshot for Step

 

When prompted for a username and password, enter the credentials of the domain administrator.

 

4.

The managed server dizzy1 should also be running. If it is not already running, start it. In another Terminal window, navigate to the domain directory, then cd into the bin subdirectory. Enter the command:

$ ./startManagedWebLogic.sh dizzy1 http://host01.example.com:8001

This runs the script to start the managed server named dizzy1. Also notice the argument that gives the URL of the domain's administration server:
http://host01.example.com:8001.

Note: Use the host name and port of the administration server of your domain.

Show Screenshot for Step

 

When prompted for a username and password, enter the credentials of the domain administrator.

 

5.

After the servers are up and running, access the WebLogic Server administration console. Open a web browser and enter the URL of the domain's administration console:
http://hostname:port/console

In this tutorial, that is: http://host01.example.com:8001/console

Note: Use the host name and port of the administration server of your domain.

On the Welcome screen, log in using the username and password entered to start the servers.

Show Screenshot for Step

 

6.

Deploying an application is a change to the domain's configuration, so it must first be locked. In the Change Center, click the Lock & Edit button.

Show Screenshot for Step

 

7.

Under Domain Structure, click Deployments.

Show Screenshot for Step

 

8.

On the right, under Deployments, click the Install button.

Show Screenshot for Step

 

9.

Find the Current Location field. Use the links to browse to the location where the zip file was extracted. Navigate to the directory deployversion1. There you will see simple.war with a radio button next to it. Select that radio button. By using the links and the radio button, the console fills in the Path field for you.

Alternatively, you can type in the path and file name in the Path field yourself.

Then click Next.

Show Screenshot for Step

 

10.

On the next screen, ensure that Install this deployment as an application is selected.

Then click Next.

Show Screenshot for Step

 

11.

On the next screen, select dizzy1.

Then click Next.

Note: If in your domain dizzy1 is not in a cluster, the selection screen will look a bit different. Select dizzy1 in either case.

Show Screenshot for Step

 

12.

On the next screen, keep all the default values and click Next.

Notice the "Archive Version" is set to the version name in the MANIFEST.MF file: v1.

Show Screenshot for Step

 

13.

On the next screen, select No, I will review the configuration later. Then click Finish.

Show Screenshot for Step

 

14.

Notice the messages that the deployment was installed, but changes must be activated. Also notice the simple (v1) application listed in the Deployments table. The "v1" in parentheses is the version name.

Show Screenshot for Step

 

15.

In the Change Center, click the Activate Changes button.

Show Screenshot for Step

 

16.

Notice the message that the changes have been activated. Also notice the simple (v1) application listed in the Deployments table is now in the "Prepared" state.

Show Screenshot for Step

 

17.

Select the check box to the left of the simple application in the Deployments table. Then use the Start drop-down list to select Servicing all requests.

Show Screenshot for Step

 

18.

Click Yes to continue.

Show Screenshot for Step

 

19.

A message is displayed indicating that a start request was sent. Momentarily you will see the State of the benefits application become "Active." This means that the application is available to those that have access to the server.

Show Screenshot for Step

 

Testing the Application

To test the newly deployed web application, perform the following steps:

1.

In another web browser, enter the host and port for the dizzy1 managed server, followed by /simple.

In this tutorial, the URL entered is:
http://host01.example.com:8003/simple

Enter information in the fields and click the OK button.

Show Screenshot for Step

 

2.

On the next screen, use the Start over... link to return to the first page.

Show Screenshot for Step

 

Using the application in this way causes it to get an HTTP Session.

Important: Do NOT close this browser window. This will represent a client using the old version of the application.

 

Updating the Application to the Second Version

To update the first version of the deployed web application with the second version, perform the following steps:

1.

Return to the Deployments page of the administration console.

In the Change Center, click the Lock & Edit button.

Select the check box to the left of the simple application in the Deployments table.

Then click the Update button.

Show Screenshot for Step

 

2.

On the next screen, click the Change Path button that corresponds to the Source path.

Show Screenshot for Step

 

3.

Find the Current Location field. Use the links to browse to the location where the zip file was extracted. Navigate to the directory deployversion2. There you will see simple.war with a radio button next to it. Select that radio button. By using the links and the radio button, the console fills in the Path field for you.

Alternatively, you can type in the path and file name in the Path field yourself.

Then click Next.

Show Screenshot for Step

 

This version of the web application has a different version name specified in the MANIFEST.MF file: v2. It also has a different heading on its pages, so when you are running the application you can easily tell "Version 1" from "Version 2."

 

4.

Back on the previous screen, the Source path has been updated to point to the simple.war file found in the deployversion2 directory.

Click the Next button.

Show Screenshot for Step

 

5.

On the next screen, notice that the Source path points to the new version. Also, notice that the Archive Version is now v2. Ensure that Allow the application to finish its current sessions and then retire is selected.

Click the Finish button.

Show Screenshot for Step

 

6.

In the Change Center, click the Activate Changes button.

Show Screenshot for Step

 

7.

In the Deployments table, notice that there are now two versions of the simple application. The one called simple (v1) has the state of "stop Running." This means that current users will continue using it. After all users have finished with it, and their sessions have timed out, the old version will be retired. The application called simple (v2) is "Active." All new users will use it.

Show Screenshot for Step

 

Testing the Application Again

To test that the old version and the new version of the application are running simultaneously, perform the following steps:

1.

To see whether the old version is still running for old users, return to the web browser that was left open. Enter information in the fields and click the OK button.

Make sure that on the second screen it still says "Version 1."

As long as the HTTP Session is valid, the old user will continue to use "Version 1."

Show Screenshot for Step

 

2.

In another web browser, enter the URL for the simple web application.

In this tutorial, the URL entered is:
http://host01.example.com:8003/simple

Note: You want this browser to use a different HTTP Session than the previous browser window. If you are using Firefox for the "old user" browser, you cannot also use Firefox for the "new user," because all windows (or tabs) of Firefox share one session. The best strategy is to use two different browser programs. For example, use Firefox for one browser and Chrome for the other.

Show Screenshot for Step

 

Notice that as a new user of the application, "Version 2" appears in the title bar.

All new users will be using "Version 2."

 

Summary

In this tutorial, you learned how to:

Resources

Credits

Hardware and Software Engineered to Work Together Copyright © 2011, Oracle and/or its affiliates. All rights reserved