Deploy and Undeploy Applications in Oracle WebLogic Server

Oracle by Example brandingDeploy and Undeploy Applications in Oracle WebLogic Server

section 0Before You Begin

In this 15-minute tutorial, you will learn how to use the Oracle WebLogic Server Administration Console to deploy a Java Enterprise Edition web application.

Background

This tutorial is part of the Oracle WebLogic Server 12c series, and assumes that you have completed these tutorials, in this order:

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 shows how to use the Oracle WebLogic Server Administration Console to deploy a simple Java Enterprise Edition web application.  With this tutorial, you can start and run the application, redeploy an updated version, and then, undeploy the application.

What Do You Need?

  • An installation of Oracle WebLogic Server 12c. See Oracle Fusion Middleware Software Downloads .
  • A properly configured WebLogic Server domain containing an Administration Server and one Managed Server with the following settings:
    • Domain directory: /u01/domains/ExampleDomain with Managed Server, server1
    • Administration Server listen address and port number: localhost:7001
    • Managed Server, server1, listen address and port number: localhost:7003
  • An example application which can be downloaded here and extracted to the folder where WebLogic Server domain and servers are located. This archive contains two directories:
    • The benefits.war which contains a sample Java web application archive to deploy.
    • The benefits2.war which contains an upgraded version of the sample Java web application archive to deploy.

Conventions

This tutorial uses the following conventions:

Variable Value
DOMAIN_HOME Environment variable /u01/domains/ExampleDomain
ORACLE_HOME /u01/app/fmw

section 1Deploy and Start an Application

To deploy a Java web application and start it using the WebLogic Server Administration Console:

  1. If the Administration Server of the domain is not already running, start it. In a terminal window, navigate to the domain directory, and enter the command:
    $ cd $DOMAIN_HOME/
    $ ./startWebLogic.sh

    At the prompt, enter the Administrator user name and password that you specified when you created the domain. password enter the credentials of the domain administrator.

  2. After the Administration Server is running, start the Managed Server, server1. In another terminal window, navigate to the DOMAIN_HOME/bin directory and enter the command:
     $ ./startManagedWebLogic.sh server1 http://localhost:7001

    Optionally, specify the host name and port of your domain's Administration Server in place of localhost:7001.

  3. On the Welcome screen, enter the user name and password that you specified when you created the domain, and then click Login.

    The home page of the Administration Console appears.

  4. In the Administration Console Change Center, click Lock & Edit.

    Deploying an application is a change to the domain's configuration, so you must first lock it.

  5. Under Domain Structure, click Deployments.

    The Summary of Deployments page appears on the right. This page displays the list of Java EE applications and standalone application modules installed to the current domain.

  6. Select Configuration, and then click Install.
  7. Use the hyperlinks next to the Current Location field to navigate to the directory in your example application folder, and then select benefits.war.

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

    Navigate to the directory in example app
    Description of the illustration [t106-currentloc.png]
  8. Click Next.

    The Choose installation type and scope page appears.

  9. Select Install this deployment as an application, and then click Next.

    The Select deployments targets page appears.

  10. Select server1, and then click Next.
  11. Retain all the default values and click Next.

    The Review your choices and click Finish page appears.

  12. Select No, I will review the configuration later, and then click Finish.

    A message about the successful deployment appears. You must, however, activate and commit the pending changes. You can also see the benefits application listed in the Deployments table.

    Navigate to the directory in example app
    Description of the illustration [t111-needsactivation.png]
  13. In the Change Center, click Activate Changes.

    A message that the changes have been activated appears. Note that the state of the benefits application listed in the Deployments table changes to Prepared.

  14. Under Summary of Deployments, select Control.
  15. In the Deployments table, select the benefits application.
  16. Click the Start drop-down list, and then select Servicing all requests.
    Navigate to the directory in example app
    Description of the illustration [t114-start.png]
  17. Click Yes to continue.

    A message indicating that a start request has been sent appears. In a few moments, you will see that the State of the benefits application changes to Active. This means that the application is available to those that have access to the server.


section 2Test the Application

To verify the Java web application deployment:

  1. In a web browser, enter the host and port for the managed server, server1, followed by /benefits.
    http://hostname:7003/benefits
    Sample app
    Description of the illustration [t200-benefits.png]
  2. Select one or more of the check boxes and click Get Information.

section 3Update the Application

To update a web application to a new version by using the WebLogic Server Administration Console:

  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.
  2. After downloading, rename benefits2.war to benefits.war. Replace the current benefits.war file with this new one.
  3. Go back to the WebLogic Server Administration Console. In the Change Center, click Lock & Edit.

    The Summary of Deployments page appears. A table that lists all the Java EE applications and standalone application modules currently installed on WebLogic Server appears in the right pane.

  4. Select the check box to the left of the benefits and click Update.
    Navigate to the directory in example app
    Description of the illustration [t113-prepared.png]
  5. From the Update Application Assistant window, click Change Path associated with the Deployment plan path.
  6. On the next screen, click Finish.
    Finish
    Description of the illustration [t113-prepared.png]
  7. In the Change Center click the Activate Changes button.
  8. In a web browser, enter the host and port for the managed server, server1 (do not put /benefits on the end of the URL).
    http://hostname:7003

    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 Managed Server, server1.


section 4Undeploy the Application

To stop an application and then remove it from the configuration of the server(s) on which it was deployed:

  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.

    Stop a running Java web application
    Description of the illustration [t400-forcestop.png]
  2. Click Yes to continue.
  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.

    Stop a running Java web application
    Description of the illustration [t402-error.png]

    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.

  4. Click Yes to continue.
  5. Messages will be displayed indicating the deployment was deleted, but the changes must be activated. In the Change Center, click the Activate Changes button.

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


next stepNext Steps

The WebLogic Server 12c collection contains a number of additional tutorials, covering a variety of topics. See the WebLogic Server 12c collection here for additional topics and content.