Showing posts with label weblogic.Deployer. Show all posts
Showing posts with label weblogic.Deployer. Show all posts

Monday, December 14, 2015

Deploy multiple applications on WebLogic server using Weblogic.Deployer command

Weblogic.Deployer is a utility by WebLogic to deploy applications to WebLogic Server apart from usual way of deploying applications using WebLogic Admin Console.

These deployments can happen on Single-Server Domain or Multiple-Servers Domain(Cluster).

We will go through both of them also look into Sub Module targeting.

Note: 

Here we will use a file name containing names of multiple applications for the deployment and will deploy each one of them on the server/servers.

1. Deployment on Single-Server Domain


A single-server WebLogic Server domain, consisting only of an Administration Server, use the -deploy command and identify the file location, with connection parameters (adminurl,username ,password) for the Administration Server. Use -name command to provide deployment name.


SingleServerDeployment.sh

WL_HOME="opt/app/bea/wlserver_10.3"
# set up class path
. "${WL_HOME}/server/bin/setWLSEnv.sh"

echo "Please enter the admin console url in following format - t3://172.64.34.24:7001"
read adminConsole_url    
echo "Please enter the username for admin console."
read adminConsole_user
echo "Please enter the password for admin console."
read adminConsole_pwd
echo "Please enter the location/directory path where EAR files are placed e.g. /opt/app/local/applications/CustomDeployment/"
read app_directory
echo "Please enter the filename containing list of the applications to be deployed"
read listOfApps

echo "Deploying applications without using the list: " $listOfApps
cat $listOfApps|\
while read currentApp
do
     
 java -cp ${WL_HOME}/server/lib/weblogic.jar weblogic.Deployer 
-adminurl $adminConsole_url 
-username $adminConsole_user 
-password $adminConsole_pwd 
-name $currentApp  
-nostage 
-deploy ${app_directory}/${currentApp}.ear
     
echo ${currentApp}'.ear is deployed.'
done
echo "Completed deploying applications using the list "

2. Deployment on Cluster


Mostly the production environments are clustered with multiple servers so user needs to deploy applications either one or more servers. Use -targets command to any server or collection of servers
to which you can deploy an application.
By using -nostage each target server must access the archive files from a single source directory for deployment. Here the location '/opt/app/local/applications/CustomDeployment/' is shared across all the cluster servers.


ClusterServerDeployment.sh

WL_HOME="opt/app/bea/wlserver_10.3"
# set up class path
. "${WL_HOME}/server/bin/setWLSEnv.sh"

echo "Please enter the domain cluster e.g. myCluster"
read domain_cluster
echo "Please enter the admin console url in following format - t3://172.64.34.24:7001"
read adminConsole_url    
echo "Please enter the username for admin console."
read adminConsole_user
echo "Please enter the password for admin console."
read adminConsole_pwd
echo "Please enter the location/directory path where EAR files are placed e.g. /opt/app/local/applications/CustomDeployment/"
read app_directory
echo "Please enter the filename containing list of the applications to be deployed"
read listOfApps

echo "Deploying applications without using the list: " $listOfApps
cat $listOfApps|\
while read currentApp
do
     
 java -cp ${WL_HOME}/server/lib/weblogic.jar weblogic.Deployer 
-adminurl $adminConsole_url 
-username $adminConsole_user 
-password $adminConsole_pwd 
-name $currentApp 
-targets ${domain_cluster} 
-nostage 
-deploy ${app_directory}/${currentApp}.ear
     
echo ${currentApp}'.ear is deployed to the cluster.'
done
echo "Completed deploying applications using the list "


3. Deployment with Sub-Module Targeting with JMS Application Modules


Certain JMS resources defined within a JMS application module can be further targeted to a JMS Server available on the module’s target during deployment. These resources are known as submodules.

Certain types of submodule require deployment to a JMS Server, such as:
  1.  Queues
  2.  Topics
For an application-scoped JMS module in an EAR use -submoduletargets command with syntax submodule_name@module_name@target_name to target a submodule option to weblogic.Deployer.


ClusterServerSubModuleDeployment.sh

WL_HOME="opt/app/bea/wlserver_10.3"
# set up class path
. "${WL_HOME}/server/bin/setWLSEnv.sh"

echo "Please enter the domain cluster e.g. myCluster"
read domain_cluster
echo "Please enter the admin console url in following format - t3://172.64.34.24:7001"
read adminConsole_url    
echo "Please enter the username for admin console."
read adminConsole_user
echo "Please enter the password for admin console."
read adminConsole_pwd
echo "Please enter the location/directory path where EAR files are placed e.g. /opt/app/local/applications/CustomDeployment/"
read app_directory
echo "Please enter the filename containing list of the applications to be deployed"
read listOfApps

echo "Deploying applications without using the list: " $listOfApps
cat $listOfApps|\
while read currentApp
do
     
 java -cp ${WL_HOME}/server/lib/weblogic.jar weblogic.Deployer 
-adminurl $adminConsole_url 
-username $adminConsole_user 
-password $adminConsole_pwd 
-name $currentApp 
-targets ${domain_cluster} 
-submoduletargets myQueue@myJMSModule@myJMSServer 
-nostage 
-deploy ${app_directory}/${currentApp}.ear
     
echo ${currentApp}'.ear is deployed to the cluster.'
done
echo "Completed deploying applications using the list "

Hope the article helps you in understanding how to deploy applications using Weblogic.Deployer utility, please leave your feedback or query