WebLogic 11g: Deploying with weblogic.Deployer

 

Uploading Deployment Files from a Remote Client

  1.  
  2. java weblogic.Deployer \
  3. -adminurl http://localhost:7001 \
  4. -username weblogic \
  5. -password weblogic \
  6. -deploy \
  7. -upload \
  8. c:\localfiles\myapp.ear
  9.  

* Uploaded to server's upload directory (defaults to ?).

Deploying to a Single-Server Domain

  1.  
  2. java weblogic.Deployer \
  3. -adminurl http://localhost:7001 \
  4. -username weblogic \
  5. -password weblogic \
  6. -deploy \
  7. -name myTestApplication \
  8. c:\localfiles\myapp.ear
  9.  

Deploying an Application with a Deployment Plan

  1.  
  2. java weblogic.Deployer \
  3. -adminurl http://localhost:7001 \
  4. -username weblogic \
  5. -password weblogic \
  6. -deploy \
  7. -name myTestDeployment \
  8. -source /myDeployments/installedApps/myApplication/app/myApplication.ear \
  9. -targets myCluster \
  10. -stage \
  11. -plan /myDeployments/installedApps/myApplication/plan/plan.xml
  12.  

Deploying an Application That Looks Up System Resources from JNDI During preStart

* Create and activate desired system resources in a separate session before deploy the application that relies on it.

Targeting Deployments to Servers, Clusters, and Virtual Hosts

* Deploy to sinple target:

  1.  
  2. java weblogic.Deployer \
  3. -adminurl http://localhost:7001 \
  4. -username weblogic \
  5. -password weblogic \
  6. -deploy \
  7. -targets companyHost c:\localfiles\myWebApp.ear
  8.  

* Deploy to more than one targets:

  1.  
  2. java weblogic.Deployer \
  3. -adminurl http://localhost:7001 \
  4. -username weblogic \
  5. -password weblogic \
  6. -deploy \
  7. -targets ManagedServer-1,ManagedServer-2 \
  8. c:\localfiles\myapp.ear
  9.  

* Deploy to a cluster target:
- To enforce strict deployment for all servers configured in a cluster:

  1.  
  2. -DClusterConstraintsEnabled=true
  3.  

Using Module-Level Targeting for Deploying an Enterprise Application

Target individual modules in an enterprise application

  1.  
  2. java weblogic.Deployer \
  3. -adminurl http://localhost:7001 \
  4. -username weblogic \
  5. -password weblogic \
  6. -name myEnterpriseApp \
  7. -targets module1@myserver1,module2@myserver2,module3@myserver3 \
  8. -stage \
  9. -deploy c:\localfiles\myEnterpriseApp.ear
  10.  

Targeting Web Application Modules

- To target Web application modules that are part of an .ear file, you can use the Web application's context-root name as the module name or specify the web-uri.
- If

  1.  
  2. <module>
  3. <web>
  4. <web-uri>myweb.war</web-uri>
  5. <context-root>/welcome</context-root>
  6. </web>
  7. </module>
  8.  

You can use context-root:

  1.  
  2. java weblogic.Deployer \
  3. -adminurl http://localhost:7001 \
  4. -username weblogic \
  5. -password weblogic \
  6. -name mywebapplication \
  7. -targets /welcome@myserver1 \
  8. -stage \
  9. -deploy c:\localfiles\myEnterpriseApp.ear
  10.  

Or web uri:

  1.  
  2. java weblogic.Deployer \
  3. -adminurl http://localhost:7001 \
  4. -username weblogic \
  5. -password weblogic \
  6. -name mywebapplication \
  7. -targets myweb.war@myserver1 \
  8. -stage \
  9. -deploy c:\localfiles\myEnterpriseApp.ear
  10.  

- For default context root, i.e. '/'

  1.  
  2. <module>
  3. <web>
  4. <web-uri>myweb.war</web-uri>
  5. <context-root>/</context-root>
  6. </web>
  7. </module>
  8.  

Then only

  1.  
  2. java weblogic.Deployer \
  3. -adminurl http://localhost:7001 \
  4. -username weblogic \
  5. -password weblogic \
  6. -name mywebapplication \
  7. -targets /@myserver1 \
  8. -stage \
  9. -deploy c:\localfiles\myEnterpriseApp.ear
  10.  

Deploying JDBC, JMS, and WLDF Application Modules

* Only available to the server to which they are targeted.
- Need to target to multiple servers or cluster to be available on them.

Targeting Application-Scoped JMS, JDBC, and WLDF Modules

* Application-scoped resource modules can be targeted independently of other EAR modules during deployment, if necessary, by using module-level targeting syntax.
* For example:

  1.  
  2. java weblogic.Deployer
  3. -adminurl http://localhost:7001
  4. -username weblogic
  5. -password weblogic
  6. -name myEnterpriseApp
  7. -targets myWebApp@myCluster,myJDBCModule@myserver1,myEJBModule@myserver1
  8. -stage
  9. -deploy c:\localfiles\myEnterpriseApp.ear
  10.  

Sub-module Targeting for Standalone JMS Modules

* For a standalone JMS module, the submodule targeting syntax is: -submoduletargets submodule_name@target_name.
* For example, to deploy a standalone JMS module on a single server instance, targeting the submodule myQueue to a JMS Server named JMSServer1, enter the command:

  1.  
  2. java weblogic.Deployer -adminurl http://localhost:7001 -username weblogic
  3. -password weblogic -name myJMSModule
  4. -targets ManagedServer1 -submoduletargets myQueue@JMSServer1
  5. -deploy c:\localfiles\myJMSModule.xml
  6.  

* To undeploy the same JMS module, enter the following command, which, assuming myJMSModule contains more than one submodule, will undeploy only the myQueue submodule; all other submodules are unaffected.

  1.  
  2. java weblogic.Deployer -adminurl http://localhost:7001 -username weblogic
  3. -password weblogic -name myJMSModule
  4. -undeploy -submoduletargets myQueue@JMSServer1
  5.  

Sub-module Targeting for Application-scoped JMS Modules

* For an application-scoped JMS module in an EAR, use the syntax: submodule_name@module_name@target_name to target a submodule.
* For example, if the queue in the above example were instead packaged as part of an Enterprise application, you would use the command:

  1.  
  2. java weblogic.Deployer -adminurl http://localhost:7001 -username weblogic
  3. -password weblogic -name myEnterpriseApp
  4. -targets ManagedServer1 -submoduletargets myQueue@myJMSModule@JMSServer1
  5. -deploy c:\localfiles\myEnterpriseApp.ear
  6.  

* To undeploy the same JMS module, enter the following command, which, assuming myEnterpriseApp contains more than one submodule, will undeploy only the myQueue submodule; all other submodules are unaffected.

  1.  
  2. java weblogic.Deployer -adminurl http://localhost:7001 -username weblogic
  3. -password weblogic -name myEnterpriseApp
  4. -undeploy -submoduletargets myQueue@myJMSModule@JMSServer1
  5.  

Deployment Stage Modes

* Determines how deployment files are made available to target servers that must deploy an application or standalone module.
* WebLogic Server provides three different options for staging files:
- stage mode,
- nostage mode,
- external_stage mode.

nostage Mode

* The Administration Server does not copy deployment unit files.
* Stage directory is ignored.
* Instead, all servers deploy using the same physical copy of the deployment files, which must be directly accessible by the Administration Server and target servers.
* With nostage deployments of exploded archive directories, WebLogic Server automatically detects changes to a deployment's JSPs or Servlets and refreshes the deployment. (This behavior can be disabled if necessary.)
* Default mode used by Admin Console to deploy only to Admin Server.
* Use when
- Deploying to a single-server domain.
- Deploying to a cluster on a multi-homed machine.
- Deploying very large applications to multiple targets or to a cluster where deployment files are available on a shared directory.
- Deploying exploded archive directories that you want to periodically redeploy after changing content.
- Deployments that require dynamic update of selected Deployment Descriptors via the Administration Console.
* Syntax

  1.  
  2. java weblogic.Deployer
  3. -adminurl http://localhost:7001
  4. -username weblogic
  5. -password weblogic
  6. -name mydeploymentname
  7. -targets myserver1,myserver2,myserver3
  8. -nostage
  9. -deploy c:\localfiles\myapp.ear
  10.  

stage Mode

* The Administration Server first copies the deployment unit source files to the staging directories of target servers.
- The staging directory is named stage by default, and it resides under the target server's root directory.
* When copying files to the staging directory, the Administration Server creates a subdirectory with the same name as the deployment name.
* The target servers then deploy using their local copy of the deployment files.
* stage mode is the default mode for:
- Administration Console when deploying to more than one WebLogic Server instance.
- Managed Servers.
- weblogic.Deployer uses the target server's staging mode as the default,
* Use when:
- Deploying small or moderate-sized applications to multiple WebLogic Server instances.
- Deploying small or moderate-sized applications to a cluster.
* Syntax:

  1.  
  2. java weblogic.Deployer -adminurl http://localhost:7001 -username weblogic
  3. -password weblogic -name mydeploymentname
  4. -targets myserver1,myserver2,myserver3 -stage
  5. -deploy c:\localfiles\myapp.ear
  6.  

external_stage Mode

* Similar to stage mode, i.e. target servers deploy apps using local copies of deployment files.
* You have to copy files to each target server's staging directory manually.
- Deployment files must be stored in a subdirectory that reflects the deployment name.

  1.  
  2. cd WL_HOME/stage
  3. mkdir myEARExternal/2.0Beta
  4. cp myear myEARExternal/2.0Beta
  5.  

* Use when you deploy very large applications to multiple machines and
- do not have a shared file system
- cannot use nostage mode
* Use the -noversion option to turn off the requirement that deployment files be on the Administration Server, but the -noversion option causes versioning information to be ignored so you cannot use the -noversion option with versioned applications.
* Syntax:

  1.  
  2. java weblogic.Deployer -adminurl http://localhost:7001 -name weblogic
  3. -password weblogic -external_stage -name myEARExternal
  4. -deploy c:\myapps\myear
  5.  

Changing the Default Staging Behavior for a Server

* The server staging mode specifies the default deployment mode for a server if none is specified at deployment time, e.g. weblogic.Deployer.
* 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.
* How to change

Distributing Applications to a Production Environment

Overview

* Copy application deployment files to all target servers and validate it.
* Application can be started in Admin mode after distribution (use the -adminmode option).

Syntax

  1.  
  2. java weblogic.Deployer -adminurl http://localhost:7001 -username weblogic
  3. -password weblogic -distribute -name myTestDeployment
  4. /myDeployments/myApplication/
  5.  

Start Application in Admin Mode

* Restricts access to the application to a configured Administration channel.
* Allows you to distribute the application or new version to a production environment without opening the application to external client connections.
* Need to configure an administration channel.
* Start a Distributed Application in admin mode:

  1.  
  2. java weblogic.Deployer -adminurl http://localhost:7001 -username weblogic
  3. -password weblogic -start -adminmode -name myTestDeployment
  4. /myDeployments/myApplication/
  5.  

* Starting a Distributed Application for new client connections:

  1.  
  2. java weblogic.Deployer -adminurl http://localhost:7001 -username weblogic
  3. -password weblogic -start -name myTestDeployment
  4.  

Deploying Shared Java EE Libraries and Dependent Applications

* A Java EE library is
- a standalone Java EE module,
- multiple Java EE modules packaged in an Enterprise application (EAR),
- or a plain JAR file that is registered with the Java EE application container upon deployment.
* After a Java EE library has been registered, you can deploy Enterprise applications that reference the library.
* Each referencing application receives a copy of the shared Java EE library module(s) on deployment (merging), and can use those modules as if they were packaged as part of the application itself.
* Need to redeploy all referencing applications after new version of library is deployed.
* Deploy as a library:

  1.  
  2. java weblogic.Deployer -adminurl http://localhost:7001 -username weblogic
  3. -password weblogic -deploy -targets myserver1,myserver2
  4. -library /deployments/myLibraryApplication/
  5.  

* Should always specify a libary version number:
- in manifest file
- use libspecver and/or libimplver options.

  1.  
  2. java weblogic.Deployer -adminurl http://localhost:7001 -username weblogic
  3. -password weblogic -deploy -targets myserver1,myserver2
  4. -library -libspecver 700 -libimplversion 7.0.0.1Beta
  5. /deployments/myLibraryApplication/
  6.  

* Deploying applications that reference libraries as ususal.
- All referenced libraries are registered on the application's target servers.
- Registered libraries meet the version requirements of the referencing application.

References

* This is part of WebLogic 11g: WebLogic Server Deployment
* Deploying Applications


* weblogic.Deployer Command-Line Reference

This entry was posted in weblogic11g. Bookmark the permalink.

Leave a Reply

Your email address will not be published.


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>