|
|
| |
The following sections describe how to deploy Web Applications:
Overview of Deploying Web Applications
Deploying a Web Application is the final step that allows 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.deploy utility, or you can use auto-deployment.
The instructions for deploying a Web Application presume 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.
There are two modes you can use to run WebLogic Server, development mode and production mode. To enable development mode, start WebLogic Server with the following flag: -Dweblogic.ProductionModeEnabled=false (this is the default behavior). To enable production mode, start WebLogic Server with the following flag: -Dweblogic.ProductionModeEnabled=true. For information on setting these modes, see Starting and Stopping WebLogic Servers.
When you specify development mode, you can use the auto-deploy feature to quickly deploy a Web Application by copying it into the applications directory of your Administration Server, located in the config/mydomain directory of the WebLogic Server installation (where mydomain is the name of a WebLogic Server domain). WebLogic Server automatically deploys any application that is copied into the applications directory. If a Web Application in .war format is modified, WebLogic Server automatically redeploys the Web Application. If the Web Application is in exploded format, see Redeploying a Web Application in Exploded Directory Format. It is not advisable to store applications in the config/mydomain/applications directory. Applications already in this directory will deploy automatically even in production mode.
You can deploy a Web Application from your file system in exploded directory format or archived .war format. Exploded directory format means the Web Application components are arranged on your file system using the standard directory structure for Web Applications. A .war archive is created by using the Java jar utility to archive the contents of a Web Application in exploded directory format.
If you are using a cluster of managed WebLogic Servers, you can specify that your Web Application be deployed on one or more "targeted" Managed Servers. The Administration Server automatically copies the Web Application to the Managed Servers in the domain that have been targeted for the Web Application.
Deploying Web Applications Using Auto-Deployment
Auto deployment is a convenience feature designed for Web Application development and should not be used for production applications. When you move your application into production, use the manual deployment procedures described in Deploying Web Applications with Production Mode Enabled. You can only deploy a Web Application using auto-deployment on the Administration Server. If an auto-deployed Web Application is targeted to any Managed Servers, the Web Application is also deployed on the Managed Servers.
Before you can use auto-deployment, you must create a functional Web Application using the correct directory structure and containing the web.xml deployment descriptor and, if necessary, the weblogic.xml deployment descriptor. You can deploy your Web Application as an archived .war file or in exploded directory format (see Directory Structure).
How to Deploy a Web Application Using Auto-Deployment
To deploy a Web Application using auto-deployment:
http://myServer:myPort/myWebApp/resource
Where:
Uploading a Web Application to the applications Directory
You can also use the Administration Console to upload a Web Application to the applications directory. This procedure can be useful if your WebLogic Server is located on a remote machine.
To upload a Web Application:
Redeploying a Web Application Using Auto-Deployment
When you modify static components of a Web Application (such as a JSPs and HTML pages) that are deployed in the applications directory, and you are using auto-deployment, the Web Application must be redeployed in order for the changes to become effective. The procedure is different for Web Applications deployed as .war archive files and Web Applications deployed in exploded directory format.
Redeploying a Web Application in a .war Archive
Modifying the archive file automatically triggers redeployment of the Web Application. If an auto-deployed Web Application is targeted to any Managed Servers, the Web Application is also redeployed 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:
touch user_domains/mydomain/applications/DefaultWebApp/WEB-INF/REDEPL OY
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:
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.
Deploying Web Applications with Production Mode Enabled
To deploy a Web Application with Production Mode enabled, you must start WebLogic Admin Server with the -DProductionModeEnabled=true flag. WebLogic Admin Server can use this feature; managed servers cannot. For more information, see Starting and Stopping WebLogic Servers.
You can deploy a Web Application using either the Administration Console or the weblogic.deploy utility. When you deploy a Web Application it is automatically deployed to all of the targeted Managed Servers in the domain. (For more information on administering Managed Servers, see Configuring WebLogic Servers and Clusters.)
It is not advisable to store applications in the config/mydomain/applications directory. In production mode, WebLogic Server will not detect applications newly placed in the config/mydomain/applications directory, but applications that were detected in the directory before switching to production mode will continue to deploy automatically.
These deployment instructions presume that you have created a functional Web Application using the correct directory structure and containing the web.xml deployment descriptor and, if needed, the weblogic.xml deployment descriptor. You can deploy your Web Application as an archived .war file or in exploded directory format. For more information, see Directory Structure.
Deploying a Web Application Using the Administration Console
To deploy a Web Application using the Administration Console:
(exploded directory format) c:\myApps\myWebApp
(archived format) c:\myApps\myWebApp.war
http://myServer:myPort/myWebApp/resource
Where:
Deploying a Web Application Using the weblogic.deploy Utility
To deploy a Web Application using the weblogic.deploy utility:
% java weblogic.deploy -port port_number -host host_name -component application:target deploy password application source
Where:
For example:
java weblogic.deploy -port 7001 -host myhost -component myWebApp:myserver deploy pswd1234 myWebApp d:\myWebApp.war
Redeploying a Web Application with Production Mode Enabled
To redeploy a Web Application with Production Mode enabled, you must start WebLogic Admin Server with the -DProductionModeEnabled=true flag. WebLogic Admin Server can use this feature; managed servers cannot. For more information, see Starting and Stopping WebLogic Servers.
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 redeployment of Web Applications:
If you need to refresh static files such as JSPs, HTML files, image files, you can use the refresh option of the weblogic.deploy utility to refresh the static file. For more information, see Refreshing Static Components Without Redeploying the Application.
Redeploying a Web Application Using the Administration Console
To redeploy a Web Application throught the Administration Console:
Note: When you redeploy a Web Application, any active HTTP sessions are lost.
Redeploying a Web Application Using the weblogic.deploy Utility
Enter the following command:
% java weblogic.deploy -port port_number -host host_name update password application source
Where:
Notes: When you redeploy a Web Application, any active HTTP sessions are lost.
Updating an application on any single server instance to which it is targeted causes it to be updated on all servers to which is targeted. For instance, if an application is targeted to a cluster, and you update it on one of the clustered servers instances, the application will be updated on all members of cluster. Similarly, if the application is targeted to a cluster and to a standalone server instance, updating it on the standalone server instance will result in its update on the cluster, and vice versa.
Partial Redeployment
Refreshing Static Components Without Redeploying the Application
To refresh static components of an application without having to redeploy the entire application, use the weblogic.refresh tool.
When you update a static file in a Web Application on the Administration Server, the file is not automatically copied to the Web Application on any Managed Servers, but you can use weblogic.refresh to refresh, add, or delete static files such as:
Refreshing JSPs does not require redeploying the Web Application because each JSP is loaded by its own classloader, of which the Web Application classloader is a parent.
Note the following limitations of this utility:
To refresh a static file:
% java weblogic.refresh -url -username -password -application -component -files -delete -root
Where:
For example, the following command refreshes the files HelloWorld.jsp and foo\ball.gif in the myWebApp Web Application:
java weblogic.refresh -url t3://localhost:7001 -username myUsername -password myPassword -application myApplication -component myWebApp -root c:\stagedir\myWebApp HelloWorld.jsp,foo\ball.gif
Un-deploying a Web Application leaves your configuration intact, but makes the Web Application unavailable to respond to client requests. To un-deploy a Web Application you can use the Administration Console or the weblogic.deploy utility:
Un-deploying a Web Application Using the Administration Console
To un-deploy a Web Application using the Administration Console:
Un-deploying a Web Application Using the weblogic.deploy Utility
To un-deploy a Web Application using the weblogic.deploy utility:
% java weblogic.deploy -port port_number -host host_name undeploy password application source
Where:
Deleting a Web Application removes all of the configuration information of your Web Application from your domain configuration and makes the Web Application unavailable to respond to client requests. You can delete a Web Application using the Administration Console or by using the weblogic.deploy utility.
Deleting a Web Application does not delete the Web Application from your file system.
Deleting a Web Application in the applications Directory
If you are running WebLogic Server in development mode (you started WebLogic Server with the -DProductionModeEnabled=false flag), to delete a Web Application in the applications directory, you must physically delete the directory or archive containing the Web Application from the applications directory.
Deleting a Web Application Using the Administration Console
To delete a Web Application using the Administration Console:
Deleting a Web Application Using the weblogic.deploy Utility
To delete a Web Application using the weblogic.deploy utility:
% java weblogic.deploy -port port_number -host host_name delete password application
Where:
Deploying Stand-Alone Web Applications
If your Web Application is stand-alone, you can specify its context root in the weblogic.xml file using the context-root element. If the Web Application is part of an EAR, specify the context root in the EAR's application.xml file. A context-root setting in application.xml takes precedence over context-root setting in weblogic.xml. See context-root Element.
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|