Network Deployment (Distributed operating systems), v8.0 > Scripting the application serving environment (wsadmin) > Manage deployed applications using wsadmin.sh
Update installed applications using wsadmin.sh
Overview
An easy way to specify command-line installation options is to use a feature of the installInteractive command that generates the options for you. After you install the application interactively once and specify all the updates that you need, look for message WASX7278I in the wsadmin output log. The default output log for wsadmin is wsadmin.traceout. We can cut and paste the data in this message into a script, and modify it. For example:
WASX7278I: Generated command line: install c:/websphere/appserver/installableapps/jmsample { -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} }Get options...
### Jacl
$AdminApp options
### Jython
print AdminApp.options()On stand-alone servers, applications restart after you save the change. On multiple-server products, applications restart after you save and synchronize.
To control when synchronization occurs on multiple-server products, from the console preferences page, deselect...
Synchronize changes with nodes
Update a single file in a deployed application
$AdminApp update app1 file {-operation update -contents /path/to/my.xml -contenturi app1.jar/my.xml}
Add a module to the deployed application.
Add if the module does not exist. Otherwise, existing module is updated.
$AdminApp update app1 modulefile {-operation addupdate -contents /path/to/Increment.jar -contenturi Increment.jar -nodeployejb -BindJndiForEJBNonMessageBinding {{"Increment EJB module" Increment Increment.jar,META-INF/ejb-jar.xml Inc}}}
Use a partial application to update a deployed application
$AdminApp update app1 partialapp {-contents /path/to/app1Partial.zip}
Update the entire deployed application
To use the existing listener port instead of using or creating a new activation specification, determine whether the EJB JAR version is lower than 2.1. The system automatically creates and uses an activation specification when you specify the -usedefaultbindings option to deploy an application. If an activation specification exists, the system ignores the listener port, and instead uses the activation specification.
To deploy an application with an EJB JAR version greater than or equal to 2.1 using the defined listener ports instead of a new activation specification, set the com.ibm.websphere.management.application.dfltbndng.mdb.preferexisting system property to true in the wsadmin.properties file in the properties directory of the profile of interest.
$AdminApp update app1 app {-operation update -contents /path/to/newApp1.jar -usedefaultbindings -nodeployejb -BindJndiForEJBNonMessageBinding {{"Increment EJB module" Increment Increment.jar,META-INF/ejb-jar.xml Inc}}}
Save and synchronize
AdminConfig.save()
AdminNodeManagement.syncActiveNodes()To propagate the changes to a specific node:
AdminNodeManagement.syncNode("myNode")
What to do next
The steps in this task return a success message if the system successfully updates the application. When updating large applications, the command might return a success message before the system extracts each binary file. We cannot start the application until the system extracts all binary files. If you installed a large application, use the isAppReady and getDeployStatus commands for the AdminApp object to verify that the system extracted the binary files before starting the application.
The isAppReady command returns a value of true if the system is ready to start the application, or a value of false if the system is not ready to start the application.
AdminApp.isAppReady('myapp1')
If the system is not ready to start the application, the system might be expanding application binaries. Use the getDeployStatus command to display additional information about the binary file expansion status, as the following example displays:
AdminApp.getDeployStatus('app1')
Run the getDeployStatus command where app1 is DefaultApplication results in status information about DefaultApplication resembling the following:
ADMA5071I: Distribution status check started for application DefaultApplication.
Use the wsadmin scripting AdminApp object for scripted administration
WebSphere:cell=myCell01,node=node1,distribution=unknown,expansion=unknown
ADMA5011I: The cleanup of the temp directory for application DefaultApplication is complete.
ADMA5072I: Distribution status check completed for application DefaultApplication.
WebSphere:cell=myCell01,node=node1,distribution=unknown,expansion=unknown
Commands for the AdminApp object using wsadmin.sh
Options for the AdminApp object install, installInteractive, edit, editInteractive, update, and updateInteractive commands using wsadmin.sh
Example: Obtaining option information for AdminApp object commands using wsadmin.sh