You are on page 1of 10

Create and Use a Deployment Plan in Oracle WebLogic Server https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-serv...

Create and Use a Deployment Plan in


Oracle WebLogic Server

Before You Begin


In this 15-minute tutorial, you will learn how to generate an initial
deployment plan for an existing web application, edit the deployment
plan, and then use the WebLogic Server Administration Console to
redeploy your application with that plan.

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

■ Install Oracle WebLogic Server 12c and Create a Basic Domain


■ Create and Configure Managed Servers

A deployment plan is an XML document that you use to define an


application's deployment configuration for a specific WebLogic Server
environment, such as development, test, or production. A deployment
plan resides outside of an application's archive file and contains
deployment properties that override an application's existing Java
Enterprise Edition and WebLogic Server deployment descriptors. Use
deployment plans to easily change an application's WebLogic Server
configuration for a specific environment, without modifying existing
deployment descriptors.

This tutorial shows how to use the weblogic.PlanGenerator


utility to generate a deployment plan. The
weblogic.PlanGenerator utility is a Java-based command-line
tool for developers who want to export portions of a WebLogic Server
deployment configuration into a deployment plan file. With this utility,
you can generate a new plan or append to an existing one. This
tutorial covers deploying versioned applications that use the version
name in the MANIFEST.MF file.

What Do You Need?


■ An installation of Oracle WebLogic Server 12c. See
http://www.oracle.com/technetwork/middleware/weblogic

1 of 10 12/12/2020 4:47 PM
Create and Use a Deployment Plan in Oracle WebLogic Server https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-serv...

/downloads/index.html.
Before You Begin
■ A properly configured WebLogic Server domain containing an
Background Administration Server and one Managed Server with the following
settings:
What Do You Need?
■ Domain directory: /u01/domains
Conventions
/ExampleDomain with Managed Server, server1
Deploy the Application ■ Administration Server listen address and port number:
localhost:7001
Generate and Edit a ■ Managed Server, server1, listen address and port
Deployment Plan
number: localhost:7003

Update the Application with ■ An example application which is available for download here. This
the Deployment Plan application archive contains three files:
■ hrapp.war, a simple web application in an archive
Next Steps file
■ deploy.py, a WebLogic Scripting Tool (WLST) script
to deploy the web application
■ deploy.sh, a shell script to deploy the web
application

Conventions
This tutorial uses the following conventions:

Variable  Value
ORACLE_HOME Environment
 /u01/app/fmw
Variable
DOMAIN_HOME Environment  /u01/domains
Variable /ExampleDomain
APP_HOME Environment  /tmp/downloads
Variable /DeployPlan

Deploy the Application


To deploy the supplied Java web application:

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

2 of 10 12/12/2020 4:47 PM
Create and Use a Deployment Plan in Oracle WebLogic Server https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-serv...

At the prompt, enter the Administrator user name and password


Before You Begin
that you specified when you created the domain.
Background 2. After the Administration Server is running, start the Managed
Server, server1. In another terminal window, navigate to the
What Do You Need?
DOMAIN_HOME/bin directory and enter the command:
Conventions

Deploy the Application $./startManagedWebLogic.sh server1 http://localhos

Generate and Edit a


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

Update the Application with 3. Deploy the web application HRApp located in the hrapp.war file.
the Deployment Plan
■ Open a new terminal window and navigate to the APP_HOME
directory.
Next Steps
■ In this tutorial, we use the deploy.sh script to deploy the
application. This script contains default values for the
Administration Server URL, the target server to which you deploy
the application, and the fully qualified path to your WebLogic
Server installation directory. To override any of these default
values, you must specify an appropriate parameter along with a
valid value in the command line while deploying the application.

For a complete list of supported parameters, run the


deploy.sh script without any arguments:

$./deploy.sh

■ Enter the command to deploy the application.


Note that the deploy.sh script uses the WebLogic Server
Scripting Tool (WLST) to deploy the application.

$./deploy.sh -a HRApp -p /tmp/downloads/DeployPl

In the command, enter the following values:


■ The name of the application, represented by -a.

■ The fully qualified path to the hrapp.war file,


represented by -p.

■ The WebLogic Server Administrator user name, represented


by -U.

■  The target server, represented by -t. This is an optional


argument. The deploy.sh script targets the application
to the Administration Server by default. To target the

3 of 10 12/12/2020 4:47 PM
Create and Use a Deployment Plan in Oracle WebLogic Server https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-serv...

application to any other server, you must specify the -t


Before You Begin
parameter along with the server name in the command line.
Background In this tutorial, we target the application to the Managed
Server, server1.
What Do You Need?
■ When prompted, enter the password for your WebLogic Server
Conventions
Administrator user name. For example:
Deploy the Application
Weblogic Server administrator password required.
Generate and Edit a Enter administrator password for user 'username'
Deployment Plan

The application deploys successfully.


Update the Application with
the Deployment Plan
>>>Deploying application from /tmp/downloads/Depl
Next Steps server1 (upload=false) ...
<Sep 17, 2018 9:59:08 PM PDT> <Info> <J2EE Depl
deploy operation for application, HRAPP [archiv
to server1.>
.Completed the deployment of Application with st
Current Status of your Deployment:
Deployment command type: deploy
Deployment State : completed
Deployment Message : no message
>>>Application HRApp deployed.

Exiting WebLogic Scripting Tool.


<Sep 17, 2018 9:59:12 PM PDT> <Warning> <JNDI> <
was called in a different thread than the one wh

Note: Ignore the warning about Context.close(). This


warning displays when you run any WLST script.
Do not close this terminal window as you will need it later.
4. To verify that the deployment was successful, access the WebLogic
Server Administration Console. Open a web browser and enter the
URL:

http://localhost:7001/console

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

5. On the Welcome screen, enter the user name and password that

4 of 10 12/12/2020 4:47 PM
Create and Use a Deployment Plan in Oracle WebLogic Server https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-serv...

you specified when you created the domain, and then click Login.
Before You Begin
6. In the left pane of the Console, under Domain Structure, select
Background Deployments. In the Deployments table, verify that HRApp is in
the Active State.
What Do You Need?

Conventions

Deploy the Application

Generate and Edit a Description of the illustration deployments_table.png


Deployment Plan
7. Access the deployed application in another browser window. Enter
Update the Application with the host and port for the Managed Server, server1, followed by
the Deployment Plan /HRApp. In this tutorial, the URL is:

Next Steps http://localhost.com:7003/HRApp

Description of the illustration app_page.png

Generate and Edit a Deployment


Plan
To generate an initial deployment plan for the web application and
then edit it:

1. Return to the same terminal window that you used to run the
deploy.sh script. Ensure that the current directory is
APP_HOME. Enter the command to run the PlanGenerator tool
on the hrapp.war file:

5 of 10 12/12/2020 4:47 PM
Create and Use a Deployment Plan in Oracle WebLogic Server https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-serv...

Before You Begin $ java weblogic.PlanGenerator -all hrapp.war

Background
Note: If you are using a new terminal window, then ensure that you
What Do You Need?
run the source setWLSEnv.sh command before running the
Conventions PlanGenerator tool. This command sets the PATH and the
CLASSPATH for executing any WLST script.
Deploy the Application

A message displays if the deployment plan is successfully generated


Generate and Edit a
for your application. Note that the deployment plan is saved to the
Deployment Plan
plan.xml file in the APP_HOME directory.

Update the Application with


the Deployment Plan Saving plan to /tmp/downloads/DeployPlan/plan.xml.
<Sep 18, 2018 2:41:37 AM PDT> <Info> <J2EE Deploym
Next Steps <Saved configuration for application, hrapp.war>

2. Now, let's edit the deployment plan that you generated. Open the
plan.xml file with a text editor and locate the <variable>
element in the file.

<variable>
<name>WeblogicWebApp_ContextRoots_1536264501
<value xsi:nil="true"></value>
</variable>

3. From the <value> tag in the <variable> element, delete


xsi:nil="true". Then, change the value tag to the context
root of the application /hr.
The modified <value> tag should resemble:

<variable>
<name>WeblogicWebApp_ContextRoots_1536264501
<value>/hr</value>
</variable>

4. Locate the <variable-assignment> element with the same


name as the <variable> element that you edited.

<variable-assignment>
<name>WeblogicWebApp_ContextRoots_15362645

6 of 10 12/12/2020 4:47 PM
Create and Use a Deployment Plan in Oracle WebLogic Server https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-serv...

<xpath>/weblogic-web-app/context-root</xpa
Before You Begin
<origin>planbased</origin>
Background </variable-assignment>
What Do You Need?

Conventions 5. Add a new <operation> child element to the <variable-


assignment> element, and set the value of the <operation>
Deploy the Application
tag to replace as shown:

Generate and Edit a


Deployment Plan <variable-assignment>
<name>WeblogicWebApp_ContextRoots_15362645
Update the Application with <xpath>/weblogic-web-app/context-root</xpa
the Deployment Plan
<origin>planbased</origin>
Next Steps <operation>replace</operation>
</variable-assignment>

6. Save the plan.xml file.

This deployment plan overrides the context-root element in


the WebLogic Server web application deployment descriptor,
weblogic.xml. The new context root is /hr.

Update the Application with the


Deployment Plan
To update the deployed web application with the new deployment
plan:

1. Go back to the WebLogic Server Administration Console. In the


Change Center, click Lock & Edit.
2. Under Domain Structure, select Deployments.
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.
3. Select the check box for the HRApp application, and click Update.
4. From the Update Application Assistant window, click Change Path
associated with the Deployment plan path.

7 of 10 12/12/2020 4:47 PM
Create and Use a Deployment Plan in Oracle WebLogic Server https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-serv...

Before You Begin

Background

What Do You Need?

Conventions

Deploy the Application

Generate and Edit a


Description of the illustration update_assistant.png
Deployment Plan
5. Select the plan.xml option, and click Next.
Update the Application with
the Deployment Plan If necessary, use the hyperlink next to the Current Location field to
navigate to the plan.xml directory.
Next Steps

Description of the illustration plan_xml.png

6. Select Redeploy this application using the following


deployment files and click Next.

8 of 10 12/12/2020 4:47 PM
Create and Use a Deployment Plan in Oracle WebLogic Server https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-serv...

Before You Begin

Background

What Do You Need?

Conventions

Deploy the Application

Generate and Edit a


Deployment Plan
Description of the illustration final_deploy.png
Update the Application with
the Deployment Plan 7. Review your choices and click Finish.
8. In the Change Center, click Activate Changes.
Next Steps
The Console displays the message: All changes have been
activated. No restarts are necessary.
9. Verify the new context root of the application. In a web browser,
enter the host and port for the Managed Server server1,
followed by /hr.

http://hostname:7003/hr

Note that the previous context root /HRApp has changed to /hr.

Description of the illustration final_app.png

9 of 10 12/12/2020 4:47 PM
Create and Use a Deployment Plan in Oracle WebLogic Server https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-serv...

Before You Begin


Next Steps
Background
The WebLogic Server 12c collection contains a number of additional
What Do You Need?
tutorials, covering a variety of topics. See the WebLogic Server 12c
Conventions collection here for additional topics and content.

Deploy the Application

Generate and Edit a


Deployment Plan
Legal Notices Terms of Use Your Privacy Rights | Cookie Preferences | Ad

Choices ight © 2019, Oracle and/or its affiliates. All rights reserved.
Update the Application with
the Deployment Plan

Next Steps

10 of 10 12/12/2020 4:47 PM

You might also like