![]() ![]() ![]() ![]() ![]() ![]() |
The following sections describe how you configure applications for deployment to a production WebLogic Server environment:
When an administrator or deployer receives a new application, or a new version of an application, from development or quality assurance teams, the application is usually configured for a development or testing environment. The application may use specific resource names and performance tuning settings that match the available resources on the target servers used in the development or QA environments where the application was last deployed.
Because development and testing environments can be significantly different from the production environment in which the application is ultimately deployed, an Administrator must configure the application to use resource names and performance tuning parameters that are valid and appropriate for the production environment.
Deployment configuration for an application can occur at several points in the lifecycle of an application. Each phase of deployment configuration typically involves creating and working with different deployment files:
Note: | Applications developed outside of the WebLogic Server development environment (for example, a sample or third-party J2EE application such as PetStore) may include only J2EE descriptors. |
Exporting an application helps deployers in other areas of the organization (such as engineers on the QA team or production Administrators) easily deploy the application to environments that differ from the programmer’s development environment. The ideal deployment plan includes all of the properties that a deployer needs to change before deploying the application in a new environment.
See Deploying Applications and Modules with weblogic.deployer.
Because deployment configuration is performed by different people at different points in the lifecycle of an application, administrators, deployers, and developers need to work together to create a repeatable configuration workflow for their organization. See Typical Deployment Configuration Workflows.
The basic deployment configuration for an application is defined in multiple XML documents, known as deployment descriptors, that are included as part of the application archive file that you receive for deployment. Deployment descriptor files fall into two separate categories:
For the purposes of a production deployment, you should treat both the J2EE and WebLogic Server deployment descriptors as part of the application’s source code, which is owned by your development team. Do not edit application deployment descriptors in order to configure an application for deployment to a production environment. Instead, persist configuration changes into a WebLogic Server deployment plan, which is described in the next section.
As previously discussed, a WebLogic Server deployment plan is an optional XML document that you use to configure an application for deployment to a specific WebLogic Server environment. A deployment plan specifies setting deployment property values that would normally be defined in an application’s WebLogic Server deployment descriptors, or overrides property values that are already defined in a WebLogic Server deployment descriptor. When exporting an application, the deployment plan typically acts to override selected properties in the WebLogic Server deployment descriptors you created during development.
Typically, deployment plans are created by developers along with the associated application files, then distributed to the Administrator or another deployer, who updates the plan for a particular environment (such as staging, testing, or production). The deployment plan is stored outside of an application archive or exploded archive directory. As a best practice, Oracle recommends storing each deployment plan for a single application in its own plan
subdirectory of the application’s root directory (See
Creating an Application Installation Directory).
Deployment plans help the Administrator easily modify an application’s WebLogic Server configuration for deployment to multiple, differing WebLogic Server environments without modifying the deployment descriptor files included in the application archive. Configuration changes are applied by adding or changing variables in the deployment plan, which define both the location of the WebLogic Server descriptor properties to change and the value to assign to those properties. Administrators deploying an application need only change the deployment plan—the original deployment files and deployment descriptors remain unchanged as shown in Figure 4-1. To determine the deployment configuration workflow for your environment, see Typical Deployment Configuration Workflows.
For the Administrator, the primary goal of configuring an application for production deployment is to generate a new deployment plan that is valid and appropriate for the target WebLogic Server environment. Specifically, the deployment plan must resolve all external resources references for the application to refer to valid resources available in the target environment. If the Application’s configuration does not define to valid external resources for the target servers, the application cannot be deployed.
A deployment plan can optionally define or override WebLogic Server tuning parameters, to make ideal use of resources in the target environment. Defining tuning parameters is not required in order to successfully deploy an application. If an application’s deployment descriptors and deployment plan do not define tuning parameters, WebLogic Server uses default values.
Deployment plans enable you to define a convenient, repeatable workflow for configuring an application for deployment to multiple WebLogic Server environments. A configuration workflow for production applications requires cooperation between your development and design teams, which create and package the deployable application, and the administrator or deployer for each target WebLogic Server environment.
The ideal deployment configuration workflow for your organization is determined by:
The sections that follow describe common deployment configuration workflows for managing deployment plans and deploying applications to multiple WebLogic Server domains.
Caution: | Oracle does not support using a deployment plan to change the context-root in an application.xml file. However, if an application is deployed as a library, you can either change the context-root through an weblogic-application.xml file or use the deployment plan to change the context-root in an weblogic-application.xml file. |
Organizations that know the exact configuration of different deployment environments can use a single, well-defined deployment plan to deploy an application to multiple WebLogic Server domains. The single deployment plan configuration workflow works in the following way:
The deployment plan that the team creates at this phase defines variables for all configuration properties that are known to differ between each target environment. For example, the plan might define empty variables for resource names that differ between environments and must be configured before the application can be deployed. The plan may also define default values for common tuning parameters that deployers may want to change in their environments.
For more information about creating a deployment plan during development, see Exporting an Application for Deployment to New Environments.
Deployers in each environment agree to limit their configuration changes to those properties defined in the deployment plan. If additional configuration changes are required, the deployer must communicate those requirements to the development or design team that modifies the master deployment plan.
Using the single deployment plan workflow provides the following benefits:
In general, you would use a single deployment plan workflow if your organization has a few, well-understood target environments, and you want to easily replicate a standardized deployment configuration in each environment.
The single deployment plan workflow assumes that the development or design team maintains ownership of the deployment plan, and that deployers limit their plan changes to those variables defined in the plan. If the deployer modifies only those properties defined in the deployment plan, their changes are written back to the same deployment plan as updates to the variables.
However, WebLogic Server imposes no restrictions on the configuration properties that a deployer can modify using the Administration Console. If a deployer configures deployment properties that were not originally defined in a plan, the Console generates a new deployment plan having the additional variable entries, and uses the new plan for deployment or redeployment operations. This can lead to a situation where the deployer uses a deployment plan that is drastically different from the master deployment plan owned by the development team.
To incorporate new changes into the master deployment plan, the deployer retrieves the new, customized deployment plan created by the Console. Ideally, those changes should be applied to the master deployment plan.
Organizations that have numerous deployment environments that frequently change should use a configuration workflow with multiple deployment plans. In a multiple deployment plan workflow, each deployment plan is owned by the deployer of the application rather than the development team. The multiple deployment plan configuration workflow works in the following way:
A custom deployment plan can be created by starting with a template deployment plan (or no deployment plan) and making changes to the application’s deployment configuration using the Administration Console. See Update a deployment plan in Administration Console Online Help.
weblogic.Deployer
or automate deployments using WLST.Using the multiple deployment plan workflow provides the following benefits:
In general, you would use a multiple deployment plan workflow if your organization has many deployment environments that change frequently, making it difficult or impossible to maintain a single master deployment plan.
The multiple deployment plan workflow assumes that the deployer or administrator (rather than the programming or design team) owns and maintains the deployment configuration for an application. It also assumes that the basic J2EE configuration of the application rarely changes, because certain J2EE configuration changes would render a deployer’s custom configuration plans invalid. For example, if a module in an Enterprise Application is added, removed, or changed, custom deployment plans referencing the module would become invalid. In this case, each deployer would need to re-create a custom plan by configuring the application using the Administration Console.
The Administration Console automatically generates (or updates) a valid XML deployment plan for an application when you interactively change deployment properties for an application that you have installed to the domain. You can use the generated deployment plan to configure the application in subsequent deployments, or you can generate new versions of the deployment plan by repeatedly editing and saving deployment properties.
Notes: |
weblogic.PlanGenerator
also enables you to generate a basic WebLogic Server deployment plan for applications that have only J2EE deployment descriptors. See weblogic.PlanGenerator Command Line Reference.context-root
in an application.xml
file. However, if an application is deployed as a library, you can either change the context-root
through an weblogic-application.xml
file or use the deployment plan to change the context-root
in an weblogic-application.xml
file.Generating a deployment plan using the Administration Console involves these steps:
The sections that follow use the WebLogic Server sample application jspExpressionEar.ear
to describe each step.
Use the following the directions to prepare your application for deployment.
app
and plan
subdirectories for your application. For example:mkdir c:\sample_root
mkdir c:\sample_root\app
mkdir c:\sample_root\plan
jspExpressionEar.ear
from
http://e-docs.bea.com/wls/docs103/jspExpressionEar.ear. Be sure to save the application to the c:\sample_root\app
directory you created in Step 1.The Administration Console uses an application installation assistant to help you install a new application for configuration and deployment to a new WebLogic Server environment. After you install an application or module and select deployment targets, the deployment files are available in the WebLogic Server domain and can be configured, distributed, and deployed as necessary.
Follow these steps to install the sample application to the examples server domain:
WL_HOME
\samples\domains\wl_server\startWebLogic.cmd
script.http://localhost:7001/console
.jspExpressionEar.ear
sample application you downloaded in Preparing the Deployment Files.
Use the Administration Console to edit deployment configuration properties for the application you installed in Installing the Application Archive and save the configuration to a deployment plan. For example, you could change properties such as the following in the jspExpressionEar.ear
sample application:
\plan
subdirectory of the root directory. For example, c:\sample_root\plan\Plan.xml
.
The deployment plan generated in Creating a New Deployment Plan to Configure an Application contains the entries shown in Sample Deployment Plan.
<deployment-plan xmlns="http://www.bea.com/ns/weblogic/90">
<application-name>sample_root</application-name>
<variable-definition>
<variable> <name>SessionDescriptor_InvalidationIntervalSecs_11029744771850</name>
<value>80</value>
</variable>
<variable>
<name>SessionDescriptor_TimeoutSecs_11029744772011</name>
<value>8000</value>
</variable>
</variable-definition>
<module-override>
<module-name>jspExpressionEar.ear</module-name>
<module-type>ear</module-type>
<module-descriptor external="false">
<root-element>weblogic-application</root-element>
<uri>META-INF/weblogic-application.xml</uri>
</module-descriptor>
<module-descriptor external="false">
<root-element>application</root-element>
<uri>META-INF/application.xml</uri>
</module-descriptor>
</module-override>
<module-override>
<module-name>jspExpressionWar</module-name>
<module-type>war</module-type>
<module-descriptor external="false">
<root-element>weblogic-web-app</root-element>
<uri>WEB-INF/weblogic.xml</uri>
<variable-assignment>
<name>SessionDescriptor_InvalidationIntervalSecs_11029744771850</name>
<xpath>/weblogic-web-app/session-descriptor/invalidation-interval-secs</xpath>
</variable-assignment>
<variable-assignment>
<name>SessionDescriptor_TimeoutSecs_11029744772011</name>
<xpath>/weblogic-web-app/session-descriptor/timeout-secs</xpath>
</variable-assignment>
</module-descriptor>
<module-descriptor external="false">
<root-element>web-app</root-element>
<uri>WEB-INF/web.xml</uri>
</module-descriptor>
</module-override>
<module-override>
<module-name>sample_root</module-name>
<module-type>ear</module-type>
<module-descriptor external="false">
<root-element>weblogic-application</root-element>
<uri>META-INF/weblogic-application.xml</uri>
</module-descriptor>
<module-descriptor external="false">
<root-element>application</root-element>
<uri>META-INF/application.xml</uri>
</module-descriptor>
</module-override>
<config-root>C:\sample_root\plan</config-root>
</deployment-plan>
The basic elements in the deployment plan serve the following functions:
deployment-plan
encapsulates all of the deployment plan’s contents.application-name
corresponds to the deployment name for the application or module.variable-definition
defines one or more variable
elements. Each variable
defines the name
of a variable used in a plan and a value
to assign (which can be null). The sample plan shown in
Sample Deployment Plan contains variable definitions for the changes you made to the Session Invalidation Interval and Session Timeout properties.module-override
elements define each module name, type, and deployment descriptor that the deployment plan overrides. A module-descriptor
element can optionally contain a variable-assignment
which identifies a variable name used to override a property in the descriptor, and the exact location within the descriptor where the property is overridden.
The sample plan shown in
Sample Deployment Plan contains module override elements for the Enterprise Application, the embedded Web application, and the enclosing root directory. The module-descriptor entry for the weblogic.xml
descriptor file contains two variable-assignment
elements that override the property values for the Session Invalidation Interval and Session Timeout properties you changed in Saving Configuration Changes to a Deployment Plan.
By default, the values in variable-assignment
elements are added to the values that are already defined in the descriptor. You can change this behavior and cause the variable-assignment
element to replace or remove the values that are defined in the descriptor by setting the operation
sub-element in the variable-assignment
element to the value replace
or remove
, respectively.
For example, suppose that in ejb-jar.xml, a developer created a policy to allow access only to the security role named ejbRole
.
...
<assembly-descriptor>
<security-role>
<role-name>ejbRole</role-name>
</security-role>
<method-permission>
<role-name>ejbRole</role-name>
<method>
<ejb-name>ejb.SearchHandlerWrapperEJB</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
</assembly-descriptor>
...
And, the security-role-assignment
element in weblogic-ejb-jar.xml, ejbRole
is mapped to the principal named user1
.
...
<security-role-assignment>
<role-name>ejbRole</role-name>
<principal-name>user1</principal-name>
</security-role-assignment>
...
If you want to use a deployment plan to override the security-role-assignment
element defined in weblogic-ejb-jar.xml, so that ejbRole
is mapped to user2
instead of user1
, you could achieve the desired override behavior by setting appropriate values for the variable
, variable-assignment
, and operation
elements in the deployment plan. Make sure to set the value of operation
to replace
:
...<variable> <name>SecurityRoleAssignment_ejbRole_PrincipalNames_11168815313911</name>
<value>user2</value>
</variable>
<variable-assignment>
<name>SecurityRoleAssignment_ejbRole_PrincipalNames_11168815313911</name>
<xpath>/weblogic-ejb-jar/security-role-assignment/[role-name="ejbRole"]/principal-name</xpath><operation>replace</operation>
</variable-assignment>
For more information about the contents of a WebLogic Server deployment plan, see http://www.bea.com/ns/weblogic/deployment-plan/1.0/deployment-plan.xsd.
Applications that you receive for deployment may come with varying levels of configuration information. If you have an existing deployment plan for an application, simply prepare the application as described in Preparing the Deployment Files and place the deployment plan in the plan
subdirectory of the application root. Then install the application using the instructions in Installing the Application Archive. The Administration Console automatically uses a deployment plan named plan.xml
in the \plan
subdirectory of an application root directory if one is available. If multiple plans are available for your application, they are placed in their own \plan
subdirectories (for example \plan1
and \plan2
), and the Administration Console cannot identify them. Therefore, the config.xml
must specify the plan you want to use. For information on config.xml
, see
Domain Configuration Files in Understanding Domain Configuration.
After you install a new application and existing deployment plan, the Administration Console validates the deployment plan configuration against the target servers and clusters that were selected during installation. If the deployment plan contains empty (null) variables, or if any values configured in the deployment plan are not valid for the target server instances, you must override the deployment plan before you can deploy the application. You can also configure tuning parameters to better suit the target environment in which you are deploying the application, as described in Saving Configuration Changes to a Deployment Plan. Changes you make to the application’s configuration are saved to a new deployment plan.
If you have a valid deployment plan that fully configures an application for the environment in which you are deploying, you can use either the Administration Console or the weblogic.Deployer
utility to deploy an application with a deployment plan to use for deployment.
Note: | Any deployment plan you use with the weblogic.Deployer utility must be complete and valid for your target servers. weblogic.PlanGenerator does not allow you to set or override individual deployment properties when it creates a plan. To deploy a new application and existing deployment plan using weblogic.Deployer , see
Deploying an Application with a Deployment Plan. |
This feature allows you to place application-specific files to be overridden into a new optional subdirectory (named /AppFileOverrides
) in the existing plan directory structure. The presence or absence of this new optional subdirectory controls whether file overrides are enabled for the deployment. If this subdirectory is present, an internal ClassFinder is added to the front of the application and module ClassLoaders for the deployment. As a result, the file override hierarchy rules follow the existing ClassLoader and resource loading rules and behaviors for applications. For more information on WLS application classloading, see
WebLogic Server Application Classloading in Developing Applications with WebLogic Server.
Note: | This mechanism is only for overriding resources and does not override classes. |
These are application-specific files and the contents are opaque to WLS, so the entire file contents will be overridden when an override file is supplied.
The files placed in the /AppFileOverrides
subdirectory are staged and distributed along with the rest of the plan directory contents and are available on all of the targets. Applications are then able to load these files as resources using the current ClassLoader (for example, using the ClassLoader.getResourceAsStream
method.) This either finds the overridden files or the files packaged in the application, depending on the configuration and whether overridden files are supplied.
For web applications, application file overrides only apply to the classpath related resources (which are in WEB-INF/classes
and WEB-INF/lib
), and do not apply to the resource path for the web application. Therefore, overrides are seen by web applications using the classloader.getResourceAsStream()
method to lookup resources, but overrides do not affect web application calls to the ServletContext.getResourceAsStream()
method.
In order to use this feature, you must:
config-root
within in the plan.config-root/AppFileOverrides
subdirectory.
The contents of the /AppFileOverrides
subdirectory use the existing plan directory structure and directory naming conventions that already exist for descriptor overrides. For more information on directory naming conventions, see Packaging Files for Deployment.
Enabling application file overrides causes a directory ClassFinder to be added to the application and module level ClassLoaders, which point to the appropriate root directories within the /AppFileOverrides
subdirectory (which is in the plan directory). The ClassFinder inserted into the front of the application’s ClassLoader is given a structure of AppDeploymentMBean.getLocalPlanDir
+ separator
+ "/AppFileOverrides"
. The ClassFinder inserted into the front of the module’s ClassLoaders is given a structure of AppDeploymentMBean.getLocalPlanDir
+ separator
+ "/AppFileOverrides"
+ separator
+ moduleURI
.
It is important to note that the application controls the file contents and format and controls whether the contents of the files are accessed by the application code. As a best practice, generic file loading overrides should be used by application code that has environment-specific properties files, and which is loading those properties files as resources using the application’s classloader. For example, the application code may do the following:
Properties myAppProps = new Properties();
InputStream iostream =
Thread.currentThread().getContextClassLoader().getResourceAsStream("myCfg/myApp.properties");
myAppProps.load(iostream);
See the following sections for information about additional deployment configuration tasks:
weblogic.Deployer
tool. See weblogic.Deployer Command-Line Reference.weblogic.PlanGenerator
tool.weblogic.PlanGenerator
tool.
plan
subdirectory of an application root directory.
![]() ![]() ![]() |