Install applications using wsadmin.sh
Jacl Examples
### Use an EAR file to install the application... $AdminApp install /path/to/appname.ear {-server servername} ### Change the application information by ### prompting you through a series of installation tasks... $AdminApp installInteractive /path/to/appname.ear ### To install the application on a cluster... $AdminApp install /path/to/appname.ear {-cluster cluster1} $AdminConfig save
Create an install script using Jacl interactive
You can use the installInteractive option to generate the code necessary to install an application.
- Install app using installInteractive, capturing output to a log file
wsadmin.sh -username username -password password | tee appfile.txt $AdminApp installInteractive /path/to/appname.ear- Look for message WASX7278I in the output file. You can cut and paste the data in this message into a JACL script. For example...
WASX7278I: Generated command line: install ../WAS51/appserver/installableapps/jmsample.ear {-BindJndiForEJBNonMessageBinding {{deplmtest.jar MailEJBObject deplmtest.jar,META-INF/ejb-jar.xml ejb/JMSampEJB1 }} -MapResRefToEJB {{deplmtest.jar MailEJBObject deplmtest.jar,META-INF/ejb-jar.xml mail/MailSession9 javax.mail.Session mail/DefaultMailSessionX } {"JavaMail Sample WebApp" mtcomps.war,WEB-INF/web.xml mail/MailSession9 javax.mail.Session mail/DefaultMailSessionY }} -MapWebModToVH {{"JavaMail Sample WebApp" mtcomps.war,WEB-INF/web.xml newhost }} -nopreCompileJSPs -novalidateApp -installed.ear.destination c:/mylocation -distributeApp -nouseMetaDataFromBinary}
- Using newly created JACL script, install the app into other clusters...
wsadmin.sh -username system \ -password password \ -f set_app.jacl clstrname "node1 node2 ..." svrprefix 1 1
### Use an EAR file to install the application... ### Using Jython list AdminApp.install('/path/to/app.ear', ['-server' 'servername']) ### Using Jython string AdminApp.install('/path/to/appname.ear '[-server servername]') ### Change the application information by prompting ### you through a series of installation tasks... AdminApp.installInteractive('/path/to/appname.ear') ### To install the application on a cluster... $AdminApp install /path/to/appname.ear{-cluster clustername} ### Jython list AdminApp.install('/path/to/appname.ear', ['-cluster' 'clustername']) ### Jython string AdminApp.install('/path/to/appname.ear', '[-cluster clustername]') AdminConfig.save()
Using Jacl
$AdminApp install /path/to/mymodule1.jar {-server server}
Using Jython list
AdminApp.install('/path/to/mymodule1.jar', '[-server server]')
Using Jython string
AdminApp.install('/path/to/mymodule1.jar', ['-server' 'server'])
Using Jacl
$AdminApp installInteractive /path/to/mymodule1.jar $AdminConfig save
Using Jython
AdminApp.installInteractive('/path/to/mymodule1.jar') AdminConfig.save()
The following examples are executed using wsadmin:
Using Jacl
set modtovh1 [list "JavaMail Sample WebApp" \ mtcomps.war,WEB-INF/web.xml \ default_host] set modtovh [list $modtovh1]
Using Jython
modtovh1 = ["JavaMail Sample WebApp", 'mtcomps.war,WEB-INF/web.xml', 'default_host'] modtovh = [modtovh1]
Using Jacl
set resreftoejb1 [list deplmtest.jar \ MailEJBObject \ deplmtest.jar,META-INF/ejb-jar.xml mail/MailSession9 \ javax.mail.Session mail/DefaultMailSession] set resreftoejb2 [list "JavaMail \ Sample WebApp" \ "" \ mtcomps.war,WEB-INF/web.xml \ mail/MailSession9 \ javax.mail.Session mail/bozo] set resreftoejb [list $resreftoejb1 $resreftoejb2]
Using Jython
resreftoejb1 = [['deplmtest.jar', \ 'MailEJBObject', \ 'deplmtest.jar,META-INF/ejb-jar.xml', \ 'mail/MailSession9', 'javax.mail.Session', \ 'mail/DefaultMailSession']] resreftoejb2 = [["JavaMail Sample WebApp", \ ' ', \ 'mtcomps.war,WEB-INF/web.xml', \ 'mail/MailSession9', \ 'javax.mail.Session', \ 'mail/bozo']]
Using Jacl
set attrs [list -MapWebModToVH $modtovh -MapResRefToEJB $resreftoejb -node node -server myserv -appname MailSampleApp]
Using Jython
attrs = ['-MapWebModToVH', modtovh, \ '-MapResRefToEJB', resreftoejb1, \ '-MapResRefToEJB', resreftoejb2, \ '-node', 'node', \ '-server', 'myserv', \ '-appname', 'MailSampleApp']
Using Jacl
$AdminApp install /opt/WebSphere/AppServer/installableApps/jmsample.ear $attrs
Using Jython
AdminApp.install('/opt/WebSphere/AppServer/installableApps/jmsample.ear', attrs)
$AdminConfig save
Using Jython
AdminConfig.save()
Use the AdminApp taskInfo command to obtain information about each task option. Use the AdminApp interactiveInstall command to step through all the installation tasks, one at a time. If you use the installInteractive command to successfully install an application, an option string logs in the wsadmin.traceout file under the message ID WASX7278I. You can copy and paste this option string into wsadmin scripts.