bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

Assembling and Configuring Web Applications

Deploying Web Applications

WebLogic Server application deployment is covered in detail at WebLogic Server Deployment. This section explains only deployment procedures that are specific to Web Applications.

Deploying a Web Application enables WebLogic Server to serve the components of a Web Application to clients. You can deploy a Web Application using one of several procedures, depending on your environment and whether or not your Web Application is in production. You can use the WebLogic Server Administration Console, the weblogic.Deployer utility, or you can use auto-deployment.

In the procedures for deploying a Web Application, it is assumed that you have created a functional Web Application that uses the correct directory structure and contains the web.xml deployment descriptor and, if needed, the weblogic.xml deployment descriptor. For an overview of the steps required to create a Web Application, see Main Steps to Create a Web Application.

The following sections provide Web Application-specific information:

- Redeploying a Web Application Using Auto-Deployment

- Requirements for Redeploying a Web Application in Production Mode

- Refreshing Static Components (JSP Files, HTML Files, Image Files, Etc.)

- Deploying Web Applications as Part of an Enterprise Application

Redeploying a Web Application Using Auto-Deployment

When you modify a component of a Web Application (such as a JSP, HTML page, or Java class) that is deployed in the applications directory and you are using auto-deployment, the Web Application must be re-deployed in order for the changes to become effective. The procedure is different for Web Applications deployed as WARs and Web Applications deployed in exploded directory format.

Redeploying a Web Application in a WAR Archive

Modifying the archive file automatically triggers re-deployment of the Web Application. If an auto-deployed Web Application is targeted to any Managed Servers, the Web Application is also re-deployed on the Managed Servers.

Redeploying a Web Application in Exploded Directory Format

You can redeploy a Web Application deployed in exploded directory format when using auto-deployment by modifying a special file called REDEPLOY, or you can use the Administration Console, or you can cause a partial redeploy by copying a new version of a class file over an old in the WEB-INF/classes directory.

Touching the REDEPLOY File

To re-deploy a Web Application by modifying the REDEPLOY file:

1. Create an empty file called REDEPLOY and place it in the WEB-INF directory of your Web Application. (You may have to create this directory.)

2. Modify the REDEPLOY file by opening it, modifying the contents (adding a space character is the easiest way to do this), and then saving the file. Alternately, on UNIX machines, you can use the touch command on the REDEPLOY file. For example:

   >     touch user_domains/mydomain/applications/DefaultWebApp/WEB-INF/REDEPLOY

   As soon as the REDEPLOY file is modified, the Web Application is redeployed.

Redeploying with the Administration Console

To redeploy a Web Application using the Administration Console:

1. Expand the Deployments node in the left pane.

2. Select the Web Application node.

3. Select the Web Application you want to redeploy.

4. Click the Undeploy button in the application's table in the right-hand pane.

5. Click the Deployed button in the application's table in the right-hand pane.

Hot-Deployment

Redeploy files in the WEB-INF/classes directory in the following way. If a class is deployed in WEB-INF/classes, then simply copying a new version of the file with a later time stamp will cause the Web Application to reload everything in the WEB-INF/classes folder with a new classloader.

The frequency in which WLS will look at the filesystem is governed through the console. In the Deployments-->Web Applications tab, select your Web Application. Go to the Configuration tab, and Files subtab, and enter a value in seconds for the Reload Period.

Requirements for Redeploying a Web Application in Production Mode

To redeploy a Web Application with Production Mode enabled, you must start the domain's Administration Server with the -Dweblogic.ProductionModeEnabled=true flag; this sets the production mode for all server instances in the domain.

When you modify a component (for instance, a servlet, JSP, or HTML page) of a Web Application on the Administration Server, you must take additional steps to refresh the modified component so that it is also deployed on any targeted Managed Servers. One way to refresh a component is to redeploy the entire Web Application. Redeploying the Web Application means that the entire Web Application (not just the modified component) is re-sent over the network to all of the Managed Servers targeted by that Web Application.

Note the following regarding re-deployment of Web Applications:

- Depending on your environment, there may be performance implications due to increased network traffic when a Web Application is re-sent to the Managed Servers.

- If the Web Application is currently in production and in use, redeploying the Web Application causes WebLogic Server to lose all active HTTP sessions for current users of the Web Application.

- If you have updated any Java class files, you must redeploy the entire Web Application to refresh the class.

- If you change the deployment descriptors, you must redeploy the Web Application.

Refreshing Static Components (JSP Files, HTML Files, Image Files, Etc.)

For applications deployed as exploded archive directories, weblogic.Deployer can refresh static files in your deployed applications. To refresh a static file:

1. Set up your development environment so that WebLogic Server classes are in your system CLASSPATH and the JDK is available. You can use the setEnv script located in the config/mydomain directory to set your environment.

2. Enter the following command:

   >     % java weblogic.Deployer -adminurl adminServerURL
   >     -user adminUserName -password adminPassword -name deploymentName
   >     -activate fileList

   Where:

   - adminServerURL is the URL of your WebLogic Administration Server.

   - adminUserName is the username for the Admistrative user.

   - adminPassword is the password of the Administrtive user.

   - deploymentName is the name of the application being refreshed.

   - fileList is a comma-separated list of files to be refreshed. Wildcard characters (*.jsp, for example) are not supported. Individual files must be specified relative to the root directory of the exploded archive deployment.

     For example, the following command refreshes the files HelloWorld.jsp in the myWebApp Web Application:

     >     java weblogic.Deployer -adminurl http://localhost:7001
     >      -username myUsername -password myPassword -name myWebApp
     >      -activate HelloWorld.jsp

For additional information about using weblogic.Deployer, see Using the WebLogic Java Utilities.

Deploying Web Applications as Part of an Enterprise Application

You can deploy a Web Application as part of an Enterprise Application. An Enterprise Application is a J2EE deployment unit that bundles together Web Applications, EJBs, and Resource Adaptors into a single deployable unit. (For more information on Enterprise Applications, see Packaging Components and Applications .) If you deploy a Web Application as part of an Enterprise Application, you can specify a string that is used in place of the actual name of the Web Application when WebLogic Server resolves a request for the Web Application. You specify the new name with the <context-root> element in the application.xml deployment descriptor for the Enterprise Application. For more information, see application.xml Deployment Descriptor Elements.

For example, for a Web Application called oranges, you would typically request a resource from the oranges Web Application with a URL such as:

>     http://host:port/oranges/catalog.jsp.

If the oranges Web Application is packaged in an Enterprise Application, you specify a value for the <context-root> as shown in the following example:

>     <module>
>        <web>
>           <web-uri>oranges.war</web-uri>
>           <context-root>fruit</context-root>
>        </web>
>     </module>

You then use the following URL to access the same resource from the oranges Web Application:

>     http://host:port/fruit/catalog.jsp

Note: You cannot deploy the same Web Application under more than one name in one Enterprise Application. You can, however, deploy the same Web Application under more than one name if each Web Application is packaged in a different Enterprise Application.