Application Deployment in Web Logic Server


Application Deployment


Applications can be deployed and undeployed using the DeployerRuntime MBean. The DeployerRuntime MBean is available in WebLogic version 7.0 and later. The following scripts provide examples of different deployment scenarios. The scripts can be used to automate the development process as well as staging, testing and production.


Activate a New Application


This script can be used to deploy and activate a new application. The application can be in WAR/EAR/JAR file format or in expanded format. The application files must be in the file system of the server.

If the application is packaged in a WAR/EAR/JAR file format but is not in the server's filesystem, the upload command can be used to copy the application file from the wlshell local filesystem to the server's filesystem.

The script contains three sections. The first one initializes the variables relevant for the script. These variables can be customized as required. The second section activates the application. The third section contains a loop to monitor the status of the deployment task.

########################################
# input variables, customize as needed
########################################

#the application to deploy
#in file format
#appfile=c:/bea812/weblogic81/samples/domains/examples/applications/ejb20_basic_statelessSession.ear
#or in expanded format
appfile=C:/bea812/weblogic81/samples/portal/portalApp

#the application name
#appname=statelessSession
appname=portalApp

#server or cluster to deploy to
#deploy to the server where wlshell is connected to
target=$SERVER


########################################
# deploy application
########################################

deployer = /DeployerRuntime/DeployerRuntime
data = new weblogic.management.deploy.DeploymentData
$data addTarget $target null

invoke ${deployer}/activate $appfile $appname null $data null


########################################
# monitor the deployment task
########################################

task = $LAST
$task getState
state = $LAST
while $state <= 1 echo "deployment task running" sleep 1000 $task getState state = $LAST end $task getStatus status = $LAST echo "deployment task finished with status =" $status


Redeploy an Existing Application


This script can be used to redeploy an application that is already deployed. The application can be in WAR/EAR/JAR file format or in expanded format.

The script contains three sections. The first one initializes the variables relevant for the script. These variables can be customized as required. The second section redeploys the application. The third section contains a loop to monitor the status of the redeployment task.

########################################
# input variables, customize as needed
########################################

#the application name
#appname=statelessSession
appname=portalApp

#server or cluster to redeploy to
#redeploy to the server where wlshell is connected to
target=$SERVER


########################################
# redeploy application
########################################

deployer = /DeployerRuntime/DeployerRuntime
data = new weblogic.management.deploy.DeploymentData
$data addTarget $target null

invoke ${deployer}/redeploy $appname $data null


########################################
# monitor the undeployment task
########################################

task = $LAST
$task getState
state = $LAST
while $state <= 1 echo "redeployment task running" sleep 1000 $task getState state = $LAST end $task getStatus status = $LAST echo "redeployment task finished with status =" $status

Remove an Application


This script can be used to deactivate and remove an application.

The script contains three sections. The first one initializes the variables relevant for the script. These variables can be customized as required. The second section removes the application. The third section contains a loop to monitor the status of the undeployment task.

########################################
# input variables, customize as needed
########################################

#the application name
#appname=statelessSession
appname=portalApp


########################################
# remove application
########################################

deployer = /DeployerRuntime/DeployerRuntime

invoke ${deployer}/remove $appname null null


########################################
# monitor the undeployment task
########################################

task = $LAST
$task getState
state = $LAST
while $state <= 1 echo "undeployment task running" sleep 1000 $task getState state = $LAST end $task getStatus status = $LAST echo "undeployment task finished with status =" $status

0 Response to "Application Deployment in Web Logic Server"

Post a Comment

Powered by Blogger