BEA Home | Events | Solutions | Partners | Products | Services | Download | Developer Center | WebSUPPORT
| WebLogic Server Doc Home | Administration Guide | Previous Topic | Next Topic | Contents | Index | View as PDF

Deploying Applications

The following sections discuss installation and deployment of applications and application components on WebLogic Server:

- Supported Formats for Deployment

- Using the Administration Console to Deploy Applications

- Updating Deployed Applications at Startup

- Auto-Deployment

Supported Formats for Deployment

J2EE applications can be deployed on WebLogic Servers either as an Enterprise Application Archive (EAR) file or in exploded directory format.

However, if an application is deployed in exploded format, we recommend that no component other than the Web application component should be in exploded format. If the application is deployed in archived format, then we recommend that all of the components of the application also be in archived format.

An archived component is either packaged as an EJB archive (JAR) file, a Web Application Archive (WAR) file, or a Resource Adaptor Archive (RAR) file.

For more information about Web applications see Configuring WebLogic Server Web Components.

For more information about Resource Adaptor components, see Managing the WebLogic J2EE Connector Architecture.

Using the Administration Console to Deploy Applications

You can use the Administration Console to install and deploy an application or application components (such as EJB JAR files) and deploy instances of application components on target WebLogic Servers. There are several steps to carry out this task:

Step 1: Configure and Deploy the Application.

To do this, do the following:

1. Select Deployments—>Applications to invoke the applications table.

2. Click on the link Configure a new Application to invoke the Create a new Application page.

3. Fill in the fields for this configuration entry for the application:

   - Give the application entry a name

   - Indicate the path to the application (EAR file)

   - Indicate whether this application is to be deployed.

4. Click Create to create the new entry.

Installing an application (or application component) via the Administration Console also creates entries for that application and application components in the configuration file for the domain (`/config/``domain_name``/config.xml`). The Administration Server also generates JMX Management Beans (MBeans) that enable configuration and monitoring of the application and application components.

Step 2: Deploying Application Components.

There are three types of component you can deploy: Web application components, EJBs or resource connector components.

Note: If you deploy application components (such as EJBs or WAR or RAR files) to Managed Servers in a cluster, you must ensure that the same application components are deployed on all servers in the cluster. To do this, you would select the cluster as the target for the deployment.

Deploying Web Application Components

To deploy a Web application component on a Managed Server, do the following:

1. Select Deployments—>Web Applications to invoke the Web Application table.

2. Click on the link Configure a new Web Application which invokes the Create a new WebApp Component configuration page.

3. Fill in the fields appropriately:

   - A name for the configuration entry for this component

   - The Uniform Resource Identifier (URI) pointing to this component (or, if the component is in exploded format, its root directory)

   - The path to the WAR file, or a path to a directory if the Web application is in exploded format

   - Select a deployment order. This determines the order in which Web applications are deployed when the server starts up. (See Deployment Order.)

   - Indicate whether this component is to be deployed.

4. Click Create to create the new component entry.

5. You can choose to deploy the component on either target Managed Servers or target clusters. Click on Targets—>Servers for deploying the component on target Managed Servers. Click on the Targets—>Clusters for deploying the component on target clusters.

6. The Available field lists Managed Servers (or Clusters if you selected Targets—>Clusters). Select the Managed Servers (or clusters) on which this Web Application is to be deployed by using the arrow buttons to move them to the Chosen field. Click Apply for your change to take effect.

For more information about configuring Web applications, see Configuring WebLogic Server Web Components.

Deploying EJB Components

To deploy EJBs on a Managed Server, do the following:

1. Select Deployments—>EJB to invoke the EJB Deployments table.

2. Click on the link Configure a new EJB which invokes the Create a new EJB Component page.

3. Fill in the fields appropriately:

   - A name for the configuration entry for this component

   - The Uniform Resource Identifier (URI) pointing to this component (or, if the component is in exploded format, its root directory)

   - The path to the JAR file

   - Select a deployment order. This determines the order in which EJBs are deployed when the server starts up. (See Deployment Order.)

   - Indicate whether this component is to be deployed.

4. Click Create to create the new component entry.

5. You can choose to deploy the component on either target Managed Servers or target clusters. Click on Targets—>Servers for deploying the component on target Managed Servers. Click on the Targets—>Clusters for deploying the component on target clusters.

6. The Available field lists Managed Servers (or Clusters if you selected Targets—>Clusters). Select the Managed Servers (or clusters) on which this Web Application is to be deployed by using the arrow buttons to move them to the Chosen field. Click Apply for your change to take effect.

Deploying Resource Adapter Components

To deploy a resource connector component on a Managed Server, do the following:

1. Select Deployments—>Connectors to invoke the Resource Connectors table.

2. Click on the link Configure a new Connector Component which invokes the Create a new Connector Component configuration page.

3. Fill in the fields appropriately:

   - A name for the configuration entry for this component

   - The Uniform Resource Identifier (URI) pointing to this component (or, if the component is in exploded format, its root directory)

   - The path to the RAR file

   - Select a deployment order. This determines the order in which resource connectors are deployed when the server starts up. (See Deployment Order.)

   - Indicate whether this component is to be deployed.

4. Click Create to create the new component entry.

5. You can choose to deploy the component on either target Managed Servers or target clusters. Click on Targets—>Servers for deploying the component on target Managed Servers. Click on the Targets—>Clusters for deploying the component on target clusters.

6. The Available field lists Managed Servers (or Clusters if you selected Targets—>Clusters). Select the Managed Servers (or clusters) on which this Web Application is to be deployed by using the arrow buttons to move them to the Chosen field. Click Apply for your change to take effect.

For more information about resource connectors, see Managing the WebLogic J2EE Connector Architecture.

When an application or application component (such as an EAR or WAR file, or EJB JAR files) is deployed to a particular WebLogic Server, the files are copied to a directory `.wlnotdelete` under `/config/``domain_name``/applications` on the target WebLogic Server. The WebLogic Administration Service invokes a file distribution servlet to copy the files to the target server.

Deployment Order

Within components of the same type, such as EJBs, you can specify the order in which they are to be deployed at server startup. The integer that you indicate in the Deployment Order field when deploying the component indicates the priority in relation to other components of the same type, such as the order of deployment among EJBs. Components that have deployment order 0 are deployed first among components of that type.

However, WebLogic Server uses an ordering among types that is not affected by this user-defined ordering among components of the same type. When WebLogic Server starts, the following class-level order is used in deployment:

1. JDBC Connection Pools

2. JDBC Multi Pools

3. JDCB Data Sources

4. JDBC Tx Data Sources

5. JMS Connection Factories

6. JMS Servers

7. Connector Components

8. EJB Components

9. Web App Components

Updating Deployed Applications at Startup

By default the Administration Server copies an application to a Managed Server at startup only if both of the following conditions are true:

- The application has been modified and redeployed.

- The Managed Server does not have the latest version of the application.

The Administration Server maintains a `StagedTargets` list that specifies which Managed Servers in a domain have the latest version of an application. At startup, a Managed Server queries its Administration Server to determine if it (the Managed Server) has the most recent version of the application. If an updated version of the application is available, it is copied to the Managed Server, and the Administration Server adds that Managed Server to the StagedTargets list.

When an Administration Server goes down, all Managed Servers are removed from the `StagedTargets` list. When the Administration Server is rebooted, each Managed Server in the domain copies its deployed applications from the Administration Server. This assures that, in the event that an application has been updated while the Administration Server was down, all Managed Servers have the same version of the application.

Forcing Application Update at Startup

A startup option for Administration Servers, `-Dweblogic.management.forceApplicationCopy`, forces Managed Servers to obtain the latest version of deployed applications at startup. If an Administration Server is started with `-Dweblogic.management.forceApplicationCopy` set to `true`, when a Managed Server in the domain starts up, the applications deployed to that Managed Server are copied from the Administration Server to the Managed Server. The startup option can be specified either on the command line or in a startup script.

Auto-Deployment

Auto-deployment is a method for quickly deploying an application on the Administration Server. It is recommended that this method be used only in a development environment for testing an application. Use of auto-deployment in a production environment or for deployment of components on Managed Servers is not recommended. You can ensure that auto-deployment is turned off if you start the Administration Server with the following argument on the `java` command line:

>     -Dweblogic.ProductionModeEnabled=true

If auto-deployment is enabled for the target WebLogic Server domain, when an application is copied into the `/config/``domain_name``/applications` directory of the WebLogic Administration Server, the Administration Server detects the presence of the new application and deploys it automatically (if the Administration Server is running). (The subdirectory `domain_name` is the name of the WebLogic Server domain that was used when starting the Administration Server.) If WebLogic Server is not running when you copy the application to the `/applications` directory, the application is deployed the next time the WebLogic Server is started.

Note that applications already in the `/config/``domain_name``/applications` directory will be deployed automatically even when production mode is enabled. It is not advisable to store applications or files in the directory `/config/``domain_name``/applications` when switching to production mode.

If you use the Administration Console to make any changes to the configuration of an application that is auto-deployed, those changes are not stored persistently, that is, no changes are made to the configuration defined in the `config.xml` for the active domain. If you make changes to the configuration of an application that is auto-deployed, those changes will be gone if you restart the Administration Server.

Enabling or Disabling Auto-Deployment

By default, auto-deployment is enabled.

To determine whether you have auto-deployment enabled, invoke the Administration Console and go to the domain applications settings page (domain_name—>Configuration—>Applications) for the domain. This page allows you to enable or disable auto-deployment and to set the interval (in milliseconds) at which the WebLogic Server checks for new applications in the `/applications` subdirectory. By default, the Administration Server checks every three seconds for changes in the `/applications` directory when auto-deployment is enabled.

Auto-Deployment of Applications in Expanded Directory Format

An application or application component can be auto-deployed either in expanded directory format or as packaged in an Enterprise Application Archive (EAR) file, a Web Application Archive (WAR) file, or a Java Archive (JAR) file.

To dynamically deploy an application in exploded format, do the following:

1. Make sure the directory name created for the exploded application is the same as the Context Path of the application.

2. Copy this subdirectory under `/config/``domain_name``/applications`, where `domain_name` is the name of the target domain where the application is to be deployed. This will automatically deploy the application if auto-deploy is enabled.

Undeployment or Redeployment of Auto-Deployed Applications

An application or application component that was auto-deployed can be dynamically redeployed while the server is running. This may be useful if you want to update a deployed application or application component without stopping and restarting the WebLogic Administration Server. To dynamically redeploy a JAR, WAR or EAR file, simply copy the new version of the file over the existing file in the `/applications` directory.

This feature is useful for developers who can simply add the copy to the `/applications` directory as the last step in their makefile, and the server will then be updated.

Redeployment of Applications Auto-Deployed in Exploded Format

You can also dynamically redeploy applications or application components that have been auto-deployed in exploded format. When an application has been deployed in exploded format, the Administration Server periodically looks for a file named `REDEPLOY` in the WEB-INF directory. If the timestamp on this file changes, the Administration Server redeploys the exploded directory.

If you want to update files in an exploded application directory, do the following:

1. When you first deploy the exploded application, create an empty file named `REDEPLOY` in the WEB-INF directory.

2. To update the exploded application, copy the updated files over the existing files in that directory.

3. After copying the new files, touch the `REDEPLOY` file in the exploded directory to alter its timestamp.

When the Administration Server detects the changed timestamp, it redeploys the contents of the exploded directory.

Copyright © 2001 BEA Systems, Inc. All rights reserved. Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.