e-docs > WebLogic Server > Assembling and Configuring Web Applications > Deploying Web Applications |
Assembling and Configuring 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
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.
To re-deploy a Web Application by modifying the REDEPLOY file:
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:
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:
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:
% java weblogic.Deployer -adminurl adminServerURL
-user adminUserName -password adminPassword -name deploymentName
-activate fileList
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.