[ Team LiB ] Previous Section Next Section

Methods of Deploying Applications

There are six ways in which you can deploy applications on WebLogic Server: auto-deployment, the weblogic.Deployer utility, the WebLogic Server Administration Console, the WebLogic Builder application, the popular Ant Java-based utility, and by manually modifying the domain config.xml file.


Auto-deployment, used during development mode only, merely entails placing the application (archived or exploded) into the domain's ./applications directory.


Beginning with WebLogic Server 8.1 , only one J2EE module may be posted within a directory without an associated application.xml that defines the application's modules.

The server will self-discover the application. This development mode is set in your administration server start script by passing parameter -Dweblogic.ProductionModeEnabeled=false. The default setting for this parameter is false; that is, auto-deployment/development mode is the default behavior. Due to security and configuration management concerns, auto-deployment is not advised for production environments.


Setting auto-deployment affects the other deployment methods. For example, using the weblogic.Deployer to activate an application also targets the application to the administration server.

To redeploy an application after making changes, simply deposit the updated archive into the applications directory mentioned earlier. To redeploy an exploded application, WebLogic Server checks the timestamp on the marker file REDEPLOY. Create this file (an empty text file) and deposit it within the exploded application's WEB-INF directory for Web applications and META-INF directory for EJBs and enterprise applications. Deposit your updated files within the exploded directory structure and modify the REDEPLOY file to alter its timestamp. The administration server will detect the change in the timestamp and redeploy the exploded application. To undeploy an application (archived or exploded) remove the archive or exploded files from the applications directory.

Deploying Applications Using the WebLogic Server Administration Console

To deploy an application using the WebLogic Administration Console, enter the Administration console at http://yourURL:port/console. The default is http://localhost:7001/console. Entering the system username and password, deploy the application using the sequence yourDomain→Deployments→Applications→Deploy a New Application as shown in Figure 7.2.

Figure 7.2. Deploying a new application.


To configure an application within its current folder, navigate to the application's folder and select the application as shown in Figure 7.3.

Figure 7.3. Selecting an application for deployment.



If you don't navigate to the application's folder—away from the initial folder—using the Upload it Through Your Browser link copies the selected application to your domain's directory. If more than one application is available, you must select either Target Application or Target Each (application) to continue. In our example, for clarity, we have only one application available.

Next, select the target servers (and/or cluster(s)) for deployment and deploy the application as shown in Figures 7.4 and 7.5.

Figure 7.4. Selecting target servers.


Figure 7.5. Deploying the application.


Any errors will be reported in the Administration Console and the WebLogic Server execution window. Deployment status is also reflected in the Administration Console as shown in Figure 7.5. Also note the Stop Application button within Figure 7.5. Click that button to undeploy any previously deployed application.

You can also deploy an exploded (nonarchived) application by navigating to and selecting the exploded application directory as you would an archived application.

Deploying Applications Using the weblogic.Deployer Utility

The weblogic.Deployer utility is a Java application that's included in your WebLogic Server installation. With this utility you can deploy or redeploy an application, deactivate or unprepare an application, remove an application, cancel a pending deployment task, and list all deployment tasks. weblogic.Deployer uses a series of options and actions to complete deployment tasks. Some commonly used weblogic.Deployer options and actions are presented in Tables 7.1 and 7.2, respectively.

Table 7.1. weblogic.Deployer Options




URL to WebLogic Administration server; syntax: http://serverName:port


Task identifier


Administrator user's name


Administrator user's password; if this option isn't used, the user will be prompted for the password


Application name


Archive location and name


Target WebLogic Server instance(s)

Table 7.2. weblogic.Deployer Actions




Cancels task initiated. Use the -id option to specify which task to cancel.


Deploys the application. If currently deployed, application is redeployed.


Activates only. Application is copied to target servers' staging. Application is ready but not available.


Redeploys application.


Activates available application. Follows -distribute or -deploy action.


Deactivates application and makes it unavailable to client. Deployment remains in target servers' staging.


Stops application and removes files from target server(s).

For a complete listing of weblogic.Deployer options and actions, refer to http://e-docs.bea.com/wls/docs81/deployment/tools.html#999152.

To deploy an application using the weblogic.Deployer utility, use the format:

$ java weblogic.Deployer [options] [actions]

To deploy/redeploy our global auction application, use the following command:

$java weblogic.Deployer -adminurl -name globalAuctions -deploy
graphics/ccc.gif –user weblogic -source e:\bea\user_projects\yourDomain\applications\globalAuctions.ear (
graphics/ccc.gif options "-password PWD" may be used, especially when writing deployment scripts )

To deactivate our global auction application, use the command

$ java weblogic.Deployer -adminurl -name globalAuctions -stop

To remove our global auction application, use the command

$ java weblogic.Deployer -adminurl -name globalAuctions -targets
graphics/ccc.gif server1, server2 -undeploy -id tag

To cancel a deployment task, use the command

$ java weblogic.Deployer -adminurl -cancel -id tag


The -id tag may be declared when using -deploy, -redeploy, or -undeploy because these tasks may be canceled or listed.

To list all unfinished deployment tasks, use this command:

$ java weblogic.Deployer -adminurl -list

To add a module to our already deployed global auction application (after updating our WAR file), use the following command:

$ java weblogic.Deployer -start -name globalAuctions -source e:\bea\user_projects

Deploying Applications Using WebLogic Builder

WebLogic Builder is a GUI-based tool intended for use as an application builder; that is, generating, editing, compiling, and validating deployment descriptors for Web applications. You can use this tool to deploy applications to a single server.

To deploy an application to a single server using WebLogic Builder, start the GUI using the script startWLBuilder.cmd (Windows) or startWLBuilder.sh (Unix), or from the Windows start menu by using the sequence start→BEA WebLogic Platform 8.1→Other Development Tools→WebLogic Builder, as shown in Figure 7.6.

Figure 7.6. Starting WebLogic Builder.


From the File menu, select Open to open the module slated for deployment as shown in Figure 7.7.

Figure 7.7. Opening a module slated for deployment.


From the Tools menu, select Connect to Server and connect to the target server as shown in Figure 7.8.

Figure 7.8. Connecting to target server.


From the Tools menu, select Deploy Module to deploy the module as shown in Figure 7.9.

Figure 7.9. Deploying the module.


Deploying Applications Using the Ant Utility

The Ant utility provides a ServerDeploy task that includes a weblogic element. Use of this weblogic element implements hot deployment (that is, deployment while the server is running) of an application or application component to WebLogic Server. The Ant build file presented in Listing 7.4 implements deployment and a component redeployment of an application named gams.


Hot deployments are not written or persisted to server configuration files (config.xml). If the server is restarted, application deployments made via hot deployment are not retained.

Listing 7.4 Ant Build File wlDeploy.xml
<?xml version="1.0"?>
<project name="WLDeploy" default="deploy" basedir=".">
     Set properties related to weblogic deployment
     <property name="weblogic.home" value="C:/bea/weblogic81/server" />
     <property name="java.home" value="C:/bea/jdk141_02" />
     <property name="lib.dir" value="C:/bea/user_projects/myDomain/lib" />
     <property name="username" value="weblogic" />
     <property name="password" value="weblogic" />
     <property name="wl.classpath" value="${weblogic.home}/lib/weblogic.jar" />

     deploy application / application component to weblogic server
    <target name="deploy">
        <serverdeploy action="deploy" source="${lib.dir}/item.ear">
         <weblogic application="gams" server="t3://localhost:7001"
            username="${username}" password="${password}"
            component="item:examplesServer" debug="true"
     Undeploy application / application component from weblogic server
    <target name="redeploy">
        <serverdeploy action="redeploy" source="${lib.dir}/item.jar" >
        <weblogic application="gams" server="t3://localhost:7001"
            username="${username}" password="${password}"

A WebLogic application deployment can be executed using the build file as shown here:

ant -buildfile wlDeploy.xml deploy

A WebLogic component redeployment can be executed using the build file as shown here:

ant -buildfile wlDeploy.xml redeploy

Ant also includes tasks for JAR, WAR, and WebLogic EJB generation that may be useful during deployment operations. For detailed instructions and examples on using Ant WebLogic and other tasks, visit the Apache Web site at http://jakarta.apache.org/ant.

Deploying Applications by Manually Modifying config.xml


Take special care when manually editing the config.xml or any other XML files associated with WebLogic Server. Direct editing should be limited to small modifications. Make a backup copy of the file before modifying it.

One last means of deploying an application is to manually modify the domain's config.xml. For simple deployments, this can be the most efficient means of deploying your application. This approach requires knowledge of XML and the WebLogic tag library. When making manual modifications, ensure that your servers' names (for example, server1, server2, and so on) are included in the resources' (such as application, database connection pool, and so forth) Target listing, as shown in Listing 7.5.

Listing 7.5 Partial Config.xml
<Application Deployed="true" Name="globalAuctions"
    StagedTargets="server1, server2" TwoPhase="true">
    <EJBComponent Name="findItemsEjb.jar" Targets="server1, server2" URI="asyncSenderEjb
    <EJBComponent Name="closeAuctionEJB.jar" Targets="server1, server2" URI="cartEjb.jar"/>
    <EJBComponent Name="ItemEjb.jar" Targets="server1, server2" URI="catalogEjb.jar"/>
    <EJBComponent Name="customerEjb.jar" Targets="server1, server2" URI="customerEjb.jar"/>
    <WebAppComponent Name="globalAuctions.war" Targets="server1, server2"
graphics/ccc.gif URI="globalAuctions.war"/>

<JDBCConnectionPool CapacityIncrement="1"
    InitialCapacity="1" MaxCapacity="10" Name="globalAuctionsPool"
    Properties="user=globalAuctions" RefreshMinutes="0"
    ShrinkPeriodMinutes="15" ShrinkingEnabled="true"
    Targets="server1, server2" TestConnectionsOnRelease="false"
    TestConnectionsOnReserve="false" URL="jdbc:pointbase:server://localhost/demo"/>
    [ Team LiB ] Previous Section Next Section