Oracle WebLogic Server 12c: Deploying and Undeploying Applications

Purpose

This tutorial shows how to use the Oracle WebLogic Server 12c administration console to deploy a Java Enterprise Edition web application.

Time to Complete

Approximately 20 minutes

Overview

A Java web application, like any Java Enterprise Edition application, can be deployed to an application server as an archive file. Web application archives use the file extension .war.

This tutorial covers using the Oracle WebLogic Server 12c (12.1.1) administration console to deploy a simple Java Enterprise Edition web application. The tutorial shows how to start and run the application. The tutorial then shows how to redeploy an updated version of the application. Finally, the tutorial shows how to undeploy the application.

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 and Starting an Application

To deploy a Java web application and start it by using the administration console, perform the following steps:

1.

Download the benefits.war file to the machine where your WebLogic Server domain and servers are. This is a sample Java web application archive to deploy.

 

2.

If the administration server of the domain is not already running, it needs to 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.

 

3.

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.

 

4.

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

 

5.

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

 

6.

Under Domain Structure, click Deployments.

Show Screenshot for Step

 

7.

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

Show Screenshot for Step

 

8.

Find the Current Location field. Use the links to browse to the location in which you placed the downloaded benefits.war file. There you will see benefits.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

 

9.

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

Then click Next.

Show Screenshot for Step

 

10.

On the next screen, select dizzy1.

Then click Next.

Show Screenshot for Step

 

11.

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

Show Screenshot for Step

 

12.

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

Show Screenshot for Step

 

13.

Notice the messages that the deployment was installed, but changes must be activated. Also notice the benefits application listed in the Deployments table.

Show Screenshot for Step

 

14.

In the Change Center click the Activate Changes button.

Show Screenshot for Step

 

15.

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

Show Screenshot for Step

 

16.

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

Show Screenshot for Step

 

17.

Click Yes to continue.

Show Screenshot for Step

 

18.

A message is displayed indicating 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 /benefits.

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

Show Screenshot for Step

 

2.

Select one or more of the check boxes and click the Get Information button.

Show Screenshot for Step

 

3.

Then click the Back To Home Page link.

Show Screenshot for Step

 

Updating the Application

To update the deployed web application with a new version, perform the following steps:

1.

Download an updated version of the web application, the benefits2.war file. The web application's deployment descriptors have been modified to use a different context root (path) to access the application.

After it has been downloaded, rename benefits2.war to benefits.war. Replace the current benefits.war file with this new one.

 

2.

Return to the Deployments page of the administration console.

If needed, in the Change Center, click the Lock & Edit button.

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

Then click the Update button.

Show Screenshot for Step

 

3.

On the next screen, click the Finish button.

Show Screenshot for Step

 

4.

In the Change Center click the Activate Changes button.

Show Screenshot for Step

 

5.

In another web browser, enter the host and port for the dizzy1 managed server (do not put /benefits on the end of the URL).

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

The new version of the benefits application has the context root of / rather than the context root of benefits, as the previous version had. In other words, the benefits application is now the default application of the dizzy1 server.

Show Screenshot for Step

 

Undeploying the Application

Undeploying an application means stopping it, and then removing it from the configuration of the server(s) on which it was deployed. The application archive file itself does not need to be removed.

To undeploy the web application, perform the following steps:

1.

Return to the Deployments page of the administration console.

Select the check box to the left of the benefits application in the Deployments table. Then use the Stop drop-down list to select Force Stop Now.

Show Screenshot for Step

 

2.

Click Yes to continue.

Show Screenshot for Step

 

3.

The benefits application has now been stopped and is no longer available. In a web browser when its URL is entered the server returns a 404 error.

Note: The web browser may have cached pages. If the benefits application does appear, click the refresh button of the web browser.

Show Screenshot for Step

 

4.

Return to the Deployments page of the administration console.

If needed, in the Change Center, click the Lock & Edit button.

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

Then click the Delete button.

Show Screenshot for Step

 

5.

Click Yes to continue.

Show Screenshot for Step

 

6.

Messages will be displayed indicating the deployment was deleted, but the changes must be activated. In the Change Center click the Activate Changes button.

Show Screenshot for Step

 

The benefits application is no longer in the domain configuration. The archive file still exists, however, and the application could be deployed again.

 

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