Oracle WebLogic Server 12c: Deploying and Undeploying Applications
This tutorial contains the following sections:
  • Purpose
  • Time to Complete
  • Overview
  • Software Requirements
  • Prerequisites
  • Deploying and Starting an Application
  • Testing the Application
  • Updating the Application
  • Undeploying the Application
  • Summary
  • Resources
  • Credits
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:
  • Oracle WebLogic Server 12c (12.1.1)
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
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.

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.

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.

Screenshot for Step
6. Under Domain Structure, click Deployments.

Screenshot for Step
7. On the right, under Deployments, click the Install button.

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.

Screenshot for Step
9. On the next screen, ensure that Install this deployment as an application is selected.
Then click Next.

Screenshot for Step
10. On the next screen, select dizzy1.
Then click Next.

Screenshot for Step
11. On the next screen, keep all the default values and click Next.

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

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.

Screenshot for Step
14. In the Change Center click the Activate Changes button.

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.

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.

Screenshot for Step
17. Click Yes to continue.

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.

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

Screenshot for Step
2. Select one or more of the check boxes and click the Get Information button.

Screenshot for Step
3. Then click the Back To Home Page link.

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.

Screenshot for Step
3. On the next screen, click the Finish button.

Screenshot for Step
4. In the Change Center click the Activate Changes button.

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.

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.

Screenshot for Step
2. Click Yes to continue.

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.

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.

Screenshot for Step
5. Click Yes to continue.

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.

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:
  • Deploy a Java Enterprise Edition web application to an instance of WebLogic Server by using the WebLogic Server administration console
  • Start and stop a web application by using the administration console
  • Update a web application to a new version by using the administration console
  • Undeploy a web application by using the administration console
Resources
  • For documentation on Oracle WebLogic Server 12c, visit the Documentation Library.
  • For more information on deployment, see the Deploying Applications document.
  • To learn more about Oracle WebLogic Server, refer to additional OBEs in the OLL website.
Credits
  • Lead Curriculum Developer: Bill Bell
  • Original OBE Created By: TJ Palazzolo

140702.15:24:49