Deploying WebLogic Server Applications
The following sections describes how to perform common deployment tasks using the Administration Console and weblogic.Deployer
utility:
The following sections describe advanced deployment tasks:
In order to deploy an application or standalone module to servers in a domain, the deployment file(s) must be accessible to the domain's Administration Server. If the files do not reside on the Administration Server machine or are not available to the Administration Server machine via a network mounted directory, use the instructions below to upload files.
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.
Note: The Administration Console upload functionality helps you upload a single archive file to the Administration Server machine for deployment. If you need to upload an exploded archive directory, use the Weblogic.Deployer Tasks.
To upload an archive file to the Administration Server machine using the Administration Console:
.ear
files or directories.war
files or directoriesWhen using weblogic.Deployer
to deploy a new application or standalone module, add the -upload
option to upload the deployment files. For example:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic
-password weblogic -name myapp -targets myserver -upload
-deploy c:\localfiles\myapp.ear
weblogic.Deployer
copies the deployment files to the Administration Server's upload directory specified by the Upload Directory Name attribute. The target servers then deploy using their local copy of the deployment files. To upload an exploded archive directory, specify the directory name instead of an archive filename (for example c:\localfiles\myappEar
).
When you deploy a deployment unit to 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).
Note: Nostage mode is the default when you deploy an application or standalone module to the Administration Server; you do not need to specify nostage mode in this case.
The Administration Console automatically defaults to nostage mode when you deploy 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 to servers on one machine:
.ear
files or directories.jar
files or directories.war
files or directories.rar
files or directoriesWhen 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 mydeploymentname
-targets myserver1,myserver2,myserver3 -nostage
-deploy c:\localfiles\myapp.ear
When deploying a deployment unit to servers on different machines, you generally use the stage deployment mode, which copies deployment files from the Administration Server to each target server before deploying. If all servers can access the deployment files from a shared directory, you can also use nostage mode, which does not copy files to the target servers. In rare circumstances you may also use external_stage mode, in which you must ensure that deployment files are copied to each server's staging directory before deployment. See Staging Modes.
Note: Stage mode is the default when you deploy an application or standalone module to a Managed Server; you do not need to specify stage mode in this case.
The Administration Console allows you to select between nostage and stage mode when deploying files. If you need to deploy in external_stage mode, use the weblogic.Deployer
instructions in the next section or in Deploying an Enterprise Application Using external_stage Mode.
To deploy a deployment unit to multiple servers on different machines:
.ear
files or directories.jar
files or directories.war
files or directories.jar
files or directoriesWhen deploying to multiple machines using the weblogic.Deployer
utility, specify the nostage or external_stage mode explicitly at the command line. The deployment uses stage mode by default if no mode is specified. For example:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic
-password weblogic -name mydeploymentname
-targets myserver1,myserver2,myserver3 -stage
-deploy c:\localfiles\myapp.ear
After you deploy an application or standalone module in a WebLogic Server domain, you can change the target server list to add new WebLogic Server instances or to remove existing server instances. If you remove a target server, only the target list itself is updated—the deployment unit remains deployed to the removed server until you explicitly undeploy it. Similarly, if you add a new target server, you must explicitly deploy the deployment unit on the new server before it is active on that server.
Note: After adding a new target list using the Administration Console, you must redeploy the deployment unit on all existing servers in order to deploy it on the newly-added target server.
.ear
files or directories.war
files or directoriesNote: You cannot use weblogic.Deployer
to remove a server from a deployment unit's target list if the application or module is already deployed.
To add a new server to the target list using weblogic.Deployer
, simply specify the new list of target servers with the deploy
command. For example:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic
-password weblogic -name mydeploymentname -deploy
-targets server1, newserver
To redeploy or stop a deployment unit that is already deployed in the domain, you reference the deployment name rather than the actual archive file or exploded directory. When redeploying a deployment unit, target servers use the available deployment files (local copies of the files, if the unit was deployed in stage mode, or the original deployment files for nostage mode). During redeployment, the application may be unavailable to clients for a short time while classes are reloaded. WebLogic Server doesn't guarantee the operation of the application and deployment task if there is an access from the client at this time. For this reason, redeployment is not recommended in production environments.
Note that when you stop a deployment unit, it is not available to clients. However, you can later redeploy a stopped deployment unit using the available source 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 deployment unit using the Administration Console:
.ear
files or directories.jar
files or directories.war
files or directories.rar
files or directoriesTo redeploy a deployment unit using the weblogic.Deployer
utility, use the redeploy command and specify the deployment name. Specifying only the deployment name redeploys an application on all existing target server instances, as in:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic
-password weblogic -name myenterpriseapp -redeploy
Note: For applications deployed in a cluster, redeployment occurs on all target server instances in the cluster. If the application was previously deployed to all servers in the cluster, you cannot subsequently redeploy the application on a subset of servers in the cluster.
If an application was previously deployed to multiple, non-clustered server instances, you can specify a target list to redeploy the application on a subset of the target servers, as in:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic
-password weblogic -name mydeploymentname -redeploy
-targets myserver1,myserver2
The weblogic.Deployer
utility uses a different command form if you want to redeploy individual modules of a deployed Enterprise Application. 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 myenterpriseapp -redeploy
-targets mymodule1@myserver1,mymodule2@myserver2
Note: If the application was previously deployed to a cluster, you must redeploy the module to the entire cluster, rather than a subset of servers. If you specify a subset of servers in the cluster, weblogic.Deployer
responds with the error:
An attempt to add server target target_name to module module_name has been rejected . This is because its parent cluster, cluster_name, is aso targeted by the module.
After you deploy a new application or standalone module to servers in a domain, the deployment name remains associated with the deployment files you selected. Even after you stop 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 undeploy the application or standalone module. If you need to redeploy a deployment unit after deleting it, you must identify the deployment files, staging mode, and deployment name using the instructions in Deploying an Application or Standalone Module to Servers on the Same Machine or Deploying an Application or Standalone Module to Servers on Multiple Machines. Undeploying a deployment unit does not remove the original source files used for deployment. It only removes the deployment's configuration from the domain, as well as any deployment files created by the system (for example, files copied with stage deployment mode).
Note: An application becomes unavailable to clients during undeployment. WebLogic Server doesn't guarantee the operation of the application and deployment task if there is an access from the client at this time.
To undeploy a deployment unit from the domain:
To undeploy a deployment unit 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
An Enterprise Application (EAR file) differs from other deployment units because the .ear
file can contain other module types (WAR and JAR archives). When you deploy an Enterprise Application using the Administration Console, you can target all of the archive's modules together, or distribute the application by targeting different modules to different servers in the domain.
After you have selected the deployment files, click the Target Each Module button to begin targeting the individual JAR and WAR modules included in the Enterprise Application.
When deploying modules to different Weblogic Server instances using the weblogic.Deployer
utility, specify individual modules using the module_name@
target_name syntax. For example:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic
-password weblogic -name myenterpriseapp
-targets module1@myserver1,module2@myserver2,module3@myserver3
-stage -deploy c:\localfiles\myapp.ear
When you specify Web Application modules that are part of an .ear
file, you must use the Web Application's context root name as the module name. For example, if the application.xml
file for a file, myapp.ear
, defines:
<module>
<web>
<web-uri>myweb.war</web-uri>
<context-root>/welcome</context-root>
</web>
</module>
you could deploy only the Web Application by using a command similar to:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic
-password weblogic -name mywebapplication -targets welcome@myserver1
-stage -deploy c:\localfiles\myapp.ear
Use external_stage mode when you want to manually copy very large files to target servers before deployment to reduce the time required to deploy the application. You can also use external_stage mode if you have a third-party application or an automated script that copies files for you. You cannot use the Administration Console to deploy in external_stage mode.
To deploy an application using external_stage mode:
myEARExternal
for the deployment name, create a myEARExternal
subdirectory in the staging directories for each target server.Note: If you do not specify a deployment name at deployment time, WebLogic Server selects a default name. See Deployment Names for more information.
java weblogic.Deployer -adminurl http://localhost:7001 -name weblogic
-password weblogic -external_stage -name myEARExternal
-deploy c:\myapps\myear
Alternate deployment descriptor files change the run-time configuration of an application without changing the application's contents. See Deploying Enterprise Applications With Alternate Deployment Descriptors for more information.
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
If you add the module newmodule.war
to a deployed application named myapp.ear
, and you update the module in the application.xml
file, you can deploy newmodule.war
by using the weblogic.Deployer
command:
java weblogic.Deployer -username myname -password mypassword
-name myapp.ear -deploy -targets newmodule.war@myserver
-source /myapp/myapp.ear
Note: This command deploys the new module without redeploying the other modules in the application. You must specify the correct file extension (.war
in the above example) for archived modules in an EAR file.
You can change the deployment order for a deployed application or standalone module by setting the ApplicationMBean LoadOrder attribute in the Administration Console. The LoadOrder
attribute controls the load order of deployments relative to one another—modules with lower LoadOrder
values deploy before those with higher values. In all cases, applications and standalone modules are deployed after the WebLogic Server instance has initialized dependent subsystems.
Notes: Modules within a deployed Enterprise Application are loaded in the order specified by the application.xml
file; you cannot change this ordering using the Administration Console.
You cannot change the load order of applications and standalone modules using the weblogic.Deployer
utility.
Modules deployed in versions of WebLogic Server prior to 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 deployments in the WebLogic Server domain:
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 standalone module using weblogic.Deployer
and you do not specify a staging mode. See Deployment Staging Modes and Staging Directories 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.
Changing the server staging mode does not affect existing applications. If you want to change the staging mode for an existing application, you must undeploy the application deployment and then redeploy it with the new staging mode.
To set the server staging mode:
When you deploy an application or standalone module using an exploded archive directory, the Administration Console allows you to directly edit selected deployment descriptors in a production environment. The changes you make are automatically persisted to the module's deployment descriptor files, and the changes are dynamically applied to all target servers that host the module.
Note: You cannot use the Administration Console to edit deployment descriptors for applications and modules that are deployed from archive files.
To edit deployment descriptors for a deployed Enterprise Application:
application.xml
descriptor).
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. If you deployed the Web Application as an exploded archive directory, you can use the weblogic.Deployer
utility to notify the server that static files have changed. See Avoiding Unnecessary JSP Recompilation on dev2dev.com.
To redeploy a single file associated within a deployment unit, specify the file name 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 to the root directory of the exploded archive directory. In the above example, the Web Application is deployed as part of an Enterprise Application, so the module directory is specified (mywebapp/copyright.html
). If the Web Application module had been deployed standalone, rather than as part of an Enterprise Application, the file would have been specified alone (copyright.html
).
You can also redeploy an entire directory of files by specifying a directory name instead of a single file:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic
-password weblogic -name mywebapp -redeploy mywebapp/myjsps
In the above example, all files and subdirectories located in the myjsps
subdirectory of the Enterprise Application are redeployed.
Note: The refresh
tools are deprecated and will be removed in a future WebLogic Server release. Use weblogic.Deployer
instead.
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
.
The WebLogic Server deployment system automatically assigns a unique ID to deployment tasks so that you can track and manage their progress.
The Administration Console allows you to monitor running and completed tasks, as well as cancel running tasks.
After deploying, redeploying, or stopping a deployment unit, the Deploy tab in the right pane shows the status of the deployment action in the deployment status tables. To view more details about an individual task, click a link in the Status of Last Action column of the table.
To view a complete list of ongoing and completed deployment tasks (as well as other domain configuration tasks) select the Tasks node in the left pane.
The weblogic.Deployer
utility enables you to monitor and cancel running deployment tasks. weblogic.Deployer
also enables you to assign your own task identification numbers for use with subsequent commands.
The following command assigns task ID 73 to a new deployment action:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic
-password weblogic -name mymodule -targets myserver -id redeployPatch2
-nowait -deploy c:\localfiles\myapp.ear
You can later check the status of the task using the following command:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic
-password weblogic -id redeployPatch2 -list
You can later check the status of running tasks using the following command:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic
-password weblogic -listtask
If a task takes too long to complete you can cancel it using the command:
java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic
-password weblogic -id redeployPatch2 -cancel