bea.com | products | dev2dev | support | askBEA |
|
e-docs > WebLogic Server > Deploying WebLogic Server Applications > Performing Common Deployment Tasks |
Deploying WebLogic Server Applications |
Performing Common Deployment Tasks
This section describes how to perform common deployment tasks using the Administration Console and weblogic.Deployer utility. It includes the following sections:
Uploading Deployment Files to the Administration Server
In order to deploy a module to servers in a domain, the deployment file(s) must be assessable to the domain's Administration Server. If the files do not reside on the Administration Server machine or are available to the Administration Server machine via a network mounted directory, use the instructions below to upload files.
Note: The upload functionality helps you upload a single archive file to the Administration Server machine for deployment. If you are deploying an exploded archive directory, use a network file copy utility to copy the exploded directory to the Administration Server Machine.
When you upload files to the Administration Server machine, the archive file is automatically placed in the server's upload directory. You can configure the path of this directory using the instructions in Changing a Server Staging Mode or Staging Directory.
To upload an archive file to the Administration Server machine using the Administration Console:
When using weblogic.Deployer to deploy a new module, add the -upload option to upload the archive file before deployment. For example:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic -password weblogic -name mymodule -targets myserver -upload -deploy c:\localfiles\myapp.ear
Deploying a New Application Module to Server(s) on One Machine
When you deploy a new module to one or more servers that reside on the same machine, you can use the nostage deployment mode. With nostage mode, the administration server and all target servers deploy using the same deployment files (deployment files are not copied to servers' stage directories).
The Administration Console automatically defaults to nostage mode when you deploy a module to the Administration Server, or to a standalone server. If you target more than one server and the servers reside on the same machine, you must manually specify nostage mode.
To deploy a module to servers on one machine:
When using the weblogic.Deployertool utility, specify the nostage mode explicitly when you deploy to servers on the same machine. For example:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic -password weblogic -name mymodule -targets myserver1,myserver2,myserver3 -nostage -deploy c:\localfiles\myapp.ear
Deploying a New Application Module to Servers on Multiple Machines
When deploying a module to servers on different machine, you generally use the stage deployment mode, which copies deployment files from the Administration Server to each target server before deploying. In rare circumstances you may also use external_stage mode, in which you must ensure that deployment files are copied to each servers staging directory before deployment. See Deployment Staging Modes for more information.
The Administration Console allows you to select between nostage and stage mode when deploying a new module. If you need to deploy in external_stage mode, use the weblogic.Deployer instructions in the next section.
To deploy a module to multiple servers on different machines:
When deploying modules to multiple machines using the weblogic.Deployer utility, specify the stage or external_stage mode explicitly at the command line. For example:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic -password weblogic -name mymodule -targets myserver1,myserver2,myserver3 -stage -deploy c:\localfiles\myapp.ear
Deploying Enterprise Application Modules to Different WebLogic Server instances
An Enterprise Application module (.EAR file) differs from other deployable modules in the .EAR file can contain other module types (.WAR and .JAR archives). When you deploy an Enterprise Application using the Administration Console, you have the opportunity to target all of the archive's modules together, or distribute the application by targeting different modules to different servers in the domain.
Note: If you want to distribute an .EAR archive's modules over multiple WebLogic Server instances, use the Administration Console for deployment. The weblogic.Deployer utility deploys all .EAR modules to the same target servers.
Deploying an Enterprise Application with an Alternate Deployment Descriptor
To specify alternate deployment descriptors (external to the deployed .EAR file) when deploying an Enterprise Application, specify the file names with the weblogic.Deployer command. Note that you cannot specify alternate descriptor files when deploying with the Administration Console.
To specify an external application.xml and weblogic-application.xml file when deploying an Enterprise Application, use the command:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic -password weblogic -name myapplication -targets myserver1,myserver2,myserver3 -stage -deploy -altappdd c:\myfiles\myextapplication.xml -altwlsappdd c:\myfiles\myextwlsapplication.xml c:\localfiles\myapp.ear
Changing the Order of Deployment for a Module
You can change the deployment order for modules by setting ApplicationMBean LoadOrder attribute in the Administration Console. The LoadOrder attribute controls the load order of deployed modules relative to one another—modules with lower LoadOrder values deploy before those with higher values. In all cases, modules are deployed after the WebLogic Server instances has initialized dependent subsystems.
Notes: You cannot change the load order of deployed modules using the weblogic.Deployer utility.
Modules deployed prior to WebLogic Server 7.0 specify the load order value in their deployment descriptor files; you cannot change this load order using the Administration Console.
Follow these steps to view or change the deployment order of modules deployed to the WebLogic Server domain:
Redeploying or Stopping a Module
To redeploy or stop a module that is already deployed in the domain, you reference the module's deployment name rather than the actual archive file or exploded directory. When redeploying a module, target servers first stop the module and then deploy it using the available deployment files (local copies of the files, if the module was deployed in stage mode, or the original deployment files for nostage mode).
If you stop a deployed module, you can later redeploy it using the available deployment files and deployment name; you do not need to reselect the deployment files, as they remain associated with the deployment name in the domain.
To redeploy or stop a module using the Administration Console:
To redeploy a module using the weblogic.Deployer utility, use the redeploy command and specify the module's deployment name. The utility uses a different command form if you want to redeploy individual modules of an Enterprise Application.
For example, to redeploy a single module on all available target servers:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic -password weblogic -name mymodule -redeploy
To redeploy a single module on a subset of the target servers, specify the target server list:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic -password weblogic -name mymodule -redeploy -targets myserver1,myserver2
To redeploy a subset of the modules of an Enterprise Application, specify modulename@servername in the target server list. For example:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic -password weblogic -name mymodule -redeploy -targets mymodule1@myserver1,mymodule2@myserver2
Redeploying Static Files in a Web Application
In a production environment, you may occasionally need to refresh the static content of a Web Application—HTML files, Image files, and so forth—without redeploying the entire application. You can use the weblogic.Deployer utility to notify the server that static files have changed.
To redeploy static files associated with a deployed module, specify the file names at the end of the redeploy command. For example:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic -password weblogic -name mywebapp -redeploy mywebapp/copyright.html
Always specify the pathname to updated files relative by starting at the top level of the exploded archive directory. In the above example, the Web Application resides in an exploded archive directory named mywebapp.
While weblogic.Deployer 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 weblogic.Deployer's refresh capability.
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.
% java weblogic.deploy -url adminServerURL -username AdminUserName -jspRefreshFiles fileList -jspRefreshComponentName component refresh password application
For example, the following command refreshes the files HelloWorld.jsp and ball.gif in the myWebApp Web Application:
java weblogic.deploy -url t3://localhost:7001
-username myUsername -jspRefreshFiles HelloWorld.jsp,ball.gif
-jspRefreshComponentName myWebApp refresh myPassword myWebApp
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.
Changing the Target List for a Deployed Module
After you have deployed a module in a WebLogic Server domain, you can change the module's target server list to add new WebLogic Server instances or to remove existing server instances. If you remove a target server, the module is immediately stopped and removed from the server. If you add a new target server, you must explicitly deploy the module on the new server before it is active.
To add a new server to the target list using weblogic.Deployer, simply add the new server name to the target command-line option. For example:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic -password weblogic -name mymodule -deploy -targets newserver
Changing a Server Staging Mode or Staging Directory
The server staging mode specifies the default deployment mode for a server if none is specified at deployment time. For example, the server staging mode is used if you deploy an application or module using weblogic.Deployer and you do not specify a staging mode. See Deployment Staging Modes for help on when to use staging modes.
Notes: You can only change the server staging mode by using the Administration Console or by directly changing the ServerMBean via JMX.
You cannot change the application staging mode without first deleting the application deployment and redeploying with the new mode.
To set the server staging mode:
Removing Files from a Deployment
If you deploy a Web Application using an exploded archive directory, you can update static contents of the Web Application either by refreshing the files (see Redeploying Static Files in a Web Application), or by deleting files from the deployment. To delete files, you must use the weblogic.Deployer utility with the delete_files option. For example:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic -password weblogic -name mywebapp -delete_files mywebapp/copyright.html
Always specify the pathname to updated files relative by starting at the top level of the exploded archive directory. In the above example, the Web Application resides in an exploded archive directory named mywebapp.
Deleting a Deployment from the Domain
After you deploy a new module to servers in a domain, the deployment name remains associated with the deployment files you selected. Even after stopping the deployment on all servers, the files remain available for redeployment using either the Administration Console or weblogic.Deployer utility.
If you want to remove a deployment name and its associated deployment files from the domain, you must explicitly delete the deployment from the domain. If you need to redeploy a module after deleting it, you must identify the deployment files, staging mode, and module name using the instructions in Deploying a New Application Module to Server(s) on One Machine or Deploying a New Application Module to Servers on Multiple Machines.
To delete a module and its deployment name from the domain:
To delete a module and its deployment name from the domain using weblogic.Deployer, specify the undeploy option. For example:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic -password weblogic -name mymodule -undeploy