| products | dev2dev | support | askBEA
 Download Docs   Site Map   Glossary 

Developing Web Applications for WebLogic Server

 Previous Next Contents Index View as PDF  

Deploying Web Applications

WebLogic Server application deployment is covered in detail in Deploying WebLogic Server Applications. 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

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.


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, 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:


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

While the weblogic.Deployer utility can refresh static files in your deployed applications, the command-line syntax for invoking earlier refresh tools remains viable. If you have scripts that invoke the WebAppComponentRefreshTool or weblogic.jspRefresh, they will now invoke the refresh capability of the weblogic.Deployer utility.

For information about the weblogic.Deployer utility, see "Deployment Tools Reference" in Deploying WebLogic Server Applications.

Use jspRefresh to refresh deployed static files such as:

You cannot use this utility to refresh Java class files.

To use jspRefresh, you must deploy the Web Application in exploded directory format. The utility does not work for components archived in WAR files.

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.deploy -url adminServerURL -username AdminUserName -jspRefreshFiles fileList -jspRefreshComponentName component refresh password application 


Note: Even though the syntax of the command says -jspRefreshFiles and -jspRefreshComponentName, you can refresh any static file using this command, not just JSP files.


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:


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:


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


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.

Deploying a Default Web Application

The default Web Application is presented to clients who do not specify a URI (or specify "/" as the URI). To configure a Web Application as a default Web Application, set the value of the context-root element to "/" in its deployment descriptor.


Back to Top Previous Next