Strategy Web Universal is a J2EE compliant web application that is packaged as a WAR (Web Application Archive) file. The deployment of the web application is typically carried out using the application server's administrative console. However, if the application must be deployed over multiple nodes (or multiple WebSphere Application Server instances of the same node) or the deployment process must be automated, resort is often made to procedures that work from command line or scripting.
For WebSphere Application Server, the command line deployment of the Strategy Web Universal can be carried out using a utility known as wsadmin. This utility can be found in the directory /bin and is a complete command line administration and scripting solution. wsadmin will work with scripts written in either jacl (default language) or jython. Typically, all the various administrative tasks are grouped/bundled into one single file (e.g. jacl) and those tasks are executed by the simple command (e.g. wsadmin.sh -f myadmintasks.jacl.)
Note: More information on wsadmin syntax and other available commands can be found at:
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/topic/com.ibm.websphere.express.doc/info/exp/ae/txml_scriptingep.html
Deployment JACL script for IBM WebSphere WSAdmin
### This script (e.g. deployMSTR.jacl) will deploy and start Strategy Web Universal
### The deployment script syntax is:
### wsadmin.sh -f deployMSTR.jacl warFileName
###
### Note: Some variables in the scripts are assumed or guessed, adjust accordingly.
###
### Steps taken are:
##
## 1) Will look for the $warName file under the default installableApps directory
## 2) Checks to see if the application is already installed and if it's running or not.
## 3) If the application is not running, being deployment process
## 4) Map application to the default host (e.g. default_host)
## 5) Map $adminserverletuser to the application admin role
## 6) Deploys with the options preCompileJSPs and noreloadEnabled
## 7) Disable auto load for the application for WAS startup performance reasons.
## 8) Save to Master configuration
## 9) Generate the plugin if a valid server is available
## 10) Start the application
## 11) Generate the HTTP/HTTPS addresses the user can view the application.
proc deploy { appName contextRoot warName adminservletuser} {
### Set up globals
global AdminControl
global AdminApp
global AdminConfig
global cellName
global defaultHost
global nodeName
global serverName
set appServerRoot ]
set profilePath ]
### Assume WAR files are installed under installableApps
set installableApps $profilePath/installableApps
set configRoot $appServerRoot/config
### Get a list of the currently installed applications
set applications
#### Check if application exists
if { != -1 } {
set obj
### If Object has info, it's running. If it is empty, it is not running.
if { > 0} {
puts "$appName already exists and it \"
} else {
puts "$appName already exists and it is not running"
}
} else {
puts "Preparing to Deploy $appName ($warName)..."
set p
set amodvh
set modvh
set rr
puts "The admin role will be mapped to $adminservletuser"
set rattr
set opts
lappend opts -node $nodeName
lappend opts -appname $appName
lappend opts -contextroot $contextRoot
lappend opts -verbose
lappend opts -preCompileJSPs
#lappend opts -nopreCompileJSPs
#lappend opts -usedefaultbindings
lappend opts -MapWebModToVH $modvh
lappend opts -MapRolesToUsers $rattr
# Binary Management options
#lappend opts -useMetaDataFromBinary
#lappend opts -nouseMetaDataFromBinary
#lappend opts -nodistributeApp
#lappend opts -distributeApp
# Class Loading and File Update Detection options
lappend opts -noreloadEnabled
#lappend opts -reloadEnabled
#lappend opts -reloadInterval 3
#lappend opts -validateinstall # off warn fail
#Startup Options
#lappend opts -nocreateMBeansForResources
#lappend opts -createMBeansForResources
puts "Installing $installableApps/$warName"
puts "With the options: $opts"
$AdminApp install $installableApps/$warName $opts
puts "For WebSphere Startup performance reasons, disabling auto load for $appName."
set deployments
set deploymentObject
set targetMappings 0]
$AdminConfig modify $targetMappings {{enable false}}
### Save the changes to Master configuration
puts "Saving all the changes to master configuration ..."
$AdminConfig save
# Regenerate the Plugin
global webServerName
if { > 0} {
global webServerNodeName
puts "Regenerate the Plugin"
if {} {
puts "Unable to regenerate the plugin, exception = $result"
}
}
puts "Deployment of $appName is Complete."
puts "Starting $appName"
set appmanager
$AdminControl invoke $appmanager startApplication $appName
puts "$appName has been started"
}
puts "Generating $appName access URLs ... "
printAppURL $appName
}
### Retrieve the value of the variable. Assuming node scope.
proc getNodeScopeVariable { varName } {
global AdminConfig
global nodeName
set node
set varSubstitutions
foreach varSubst $varSubstitutions {
set getVarName
if { == 0} {
set res
return $res
}
}
}
### Recursively resolve the variable.
proc resolve { str } {
set i
set j
# Check if there is an opening bracket for a variable.
if {$i != -1} {
set subVar ]
set subVarValue
set str $j $subVarValue]
# Continue resolving variables if there are more
if { != -1} {
set str
}
}
return $str
}
### Print HTTP and HTTPS URLs for the application. Script assumes index.jsp is the default index page for the application.
proc printAppURL {appName} {
### Set up globals
global AdminConfig
global AdminApp
global AdminControl
### Get a list of the currently installed applications
set applications
#### Check if application exists
if { != -1 } {
global serverName
global nodeName
global wcSecure
global wc
global bsAddr
set node
puts " Will use $wcSecure port for HTTPS port"
puts " Will use $wc for port HTTP port"
puts " Will use $bsAddr host for WAS address"
set serverEntries
set port ""
set host ""
set sport ""
### Find wc port, wcSecure port, and bsAddress host.
foreach serverEntry $serverEntries {
set sName
if {$sName == $serverName} {
set specialEndPoints 0]
foreach specialEndPoint $specialEndPoints {
set endPointNm
set ePoint
if {$endPointNm == $wc} {
set port 0] 1]
}
if {$endPointNm == $bsAddr} {
set host 0] 1]
}
if {$endPointNm == $wcSecure} {
set sport 0] 1]
}
}
}
}
### Check if application is running.
set obj
### If it is empty, it is not running.
if { == 0} {
puts "WARNING: $appName is not running"
}
puts "Address: http://$host:$port/$appName/index.jsp"
puts "Secure Address: https://$host:$sport/$appName/index.jsp"
} else {
puts "Application $appName does not exist"
}
}
## Assumed variables, adjust accordingly
set defaultHost default_host
set wc WC_defaulthost
set wcSecure WC_defaulthost_secure
set bsAddr BOOTSTRAP_ADDRESS
# Search for app servers and web servers. Assume both servers are under the same cell and there is at least one app server.
set cellName ""
set cell ""
set nodeName ""
set serverName ""
set webServerName ""
set webServerNodeName ""
foreach c {
foreach n {
foreach s {
set sName
## Use the first app server on the app server list.
set appServ 0]
if { > 0 && $sName == } {
set serverName $sName
set nodeName
set cellName
}
## Get webServerNode if it exists. Use first web server on the web server list
set webServ 0]
if { > 0 && $sName == } {
set webServerName $sName
set webServerNodeName
}
}
}
}
if { > 0} {
puts "Using Application Server: $serverName"
} else {
puts "There is no available Application Servers"
return;
}
if { > 0} {
puts "Found Web Server: $webServerName"
}
### Main
if { $argc > 0 } {
set warName
set adminServletUser "admin"
## Verify that the war file name is valid and make the file (not incl. ext) the appName.
## Having more than one argument will override the appName
set i
if {$i == -1} {
puts "Invalid WAR File: $warName"
return;
} else {
set appName ]
set ext ]
if { != 4} {
puts "Invalid WAR File: $warName"
return;
}
}
### Optional (second) argument is the Application name
if { $argc > 1 } {
set appName
}
### Optional (third) argument is the user that will map to the admin role
if { $argc > 2 } {
set adminServletUser
}
### For simplicity, will make contextRoot the same as appName
set contextRoot $appName
deploy $appName $contextRoot $warName $adminServletUser
} else {
puts "Deploy Syntax: deployMSTR.jacl warFileName (e.g. Strategy.war) \ \"
}
Third Party Software Installation
WARNING:
The third-party product(s) discussed in this technical note is manufactured by vendors independent of Strategy. Strategy makes no warranty, express, implied or otherwise, regarding this product, including its performance or reliability.