Install enterprise applications using wsadmin.sh
Use the AdminApp object or the AdminApplication script library to install an application to the application server run time. We can install an enterprise archive file (EAR), web application archive (WAR) file, servlet archive (SAR), or Java archive (JAR) file.
On a network deployment installation, verify that the deployment manager is running before we install an application. Use the startManager command utility to start the deployment manager.
There are two ways to complete this task. Complete the steps in this topic to use the AdminApp object to install enterprise applications. Alternatively, we can use the scripts in the AdminApplication script library to install, uninstall, and administer the application configurations.
The scripting library provides a set of procedures to automate the most common administration functions. We can run each script procedure individually, or combine several procedures to quickly develop new scripts.
Use this topic to install an application from an enterprise archive file (EAR), a web application archive (WAR) file, a servlet archive (SAR), or a Java archive (JAR) file. The archive file must end in .ear, .jar, .sar or .war for wsadmin.sh to complete the installation. The wsadmin tool uses these extensions to determine the archive type. The wsadmin tool automatically wraps WAR and JAR files as an EAR file.
Use the most recent product version of wsadmin.sh when installing applications to mixed-version environments to ensure that the most recent wsadmin options and commands are available. bprac
Tasks
- Start the wsadmin scripting tool.
- Determine which options to use to install the application in the configuration.
For example, if the configuration consists of a node, a cell, and a server, we can specify that information when you enter the install command. Review the list of valid options for the install and installinteractive commands in the Options for the AdminApp object install, installInteractive, edit, editInteractive, update, and updateInteractive commands topic to locate the correct syntax for the -node, -cell, and -server options. For this configuration.examples:
Use Jython:
AdminApp.install('location_of_ear.ear','[-node nodeName -cell cellName -server serverName]')Use Jacl:
$AdminApp install "location_of_ear.ear" {-node nodeName -cell cellName -server serverName}We can also obtain a list of supported options for an enterprise archive (EAR) file using the options command, for example:
Use Jython:
print AdminApp.options()Use Jacl:
$AdminApp optionsWe can set or update a configuration value using options in batch mode. To identify which configuration object is to be set or updated, the values of read only fields are used to find the corresponding configuration object. All the values of read only fields have to match with an existing configuration object, otherwise the command fails.
Use pattern matching to simplify the task of supplying required values for certain complex options. Pattern matching only applies to fields required or read only.
- Choose to use the install or installInteractive command to install the application.
We can install the application in batch mode, using the install command, or we can install the application in interactive mode using the installinteractive command. Interactive mode prompts you through a series of tasks to provide information. Both the install command and the installinteractive command support the set of options we chose to use for our installation in the previous step.
- Install the application. For this example, only the -server option is used with the install command, where the value of the -server option is serv2. Customize your install or installinteractive command with on the options we chose based on the configuration.
- Use the install command to install the application in batch mode:
- For a network deployment installation only, the following command uses the EAR file and the command option information to install the application on a cluster:
- Jython string:
(Dist)
AdminApp.install('c:/MyStuff/application1.ear', '[-cluster cluster1]')(ZOS)AdminApp.install('MyStuff/application1.ear', '[-cluster cluster1]')(iSeries)AdminApp.install('/home/myProfile/MyStuff/application1.ear', '[-cluster cluster1]')- Jython list:
(Dist)
AdminApp.install('c:/MyStuff/application1.ear', ['-cluster', 'cluster1'])(ZOS)AdminApp.install('MyStuff/application1.ear', ['-cluster', 'cluster1'])(iSeries)AdminApp.install('/home/myProfile/MyStuff/application1.ear', ['-cluster', 'cluster1'])- Jacl:
(Dist)
$AdminApp install "c:/MyStuff/application1.ear" {-cluster cluster1}(ZOS)$AdminApp install "MyStuff/application1.ear" {-cluster cluster1}(iSeries)$AdminApp install "/home/myProfile/MyStuff/application1.ear" {-cluster cluster1}
Element Description $ Jacl operator for substituting a variable name with its value AdminApp object allowing application objects to be managed install AdminApp command MyStuff/application1.ear Name of the application to install cluster n installation option cluster1 the value of the cluster option which will be cluster name
- Use the installInteractive command to install the application using interactive mode. The following command changes the application information by prompting you through a series of installation tasks:
- Jython:
(Dist)
AdminApp.installInteractive('c:/MyStuff/application1.ear')(ZOS)AdminApp.installInteractive('MyStuff/application1.ear')(iSeries)AdminApp.installInteractive('/home/myProfile/MyStuff/application1.ear')- Jacl:
(Dist)
$AdminApp installInteractive "c:/MyStuff/application1.ear"(ZOS)$AdminApp installInteractive "MyStuff/application1.ear"(iSeries)$AdminApp installInteractive "/home/myProfile/MyStuff/application1.ear"
Element Description $ Jacl operator for substituting a variable name with its value AdminApp object allowing application objects to be managed installInteractive AdminApp command MyStuff/application1.ear Name of the application to install
- Save the configuration changes.
AdminConfig.save()- In a network deployment environment only, synchronize the node.
What to do next
The steps in this task return a success message if the system successfully installs the application. However, the steps might complete successfully before the system extracts each binary file. In a network deployment environment, for example, binary files are extracted after node synchronization is complete. We cannot start the application until the system extracts all binary files. Use the isAppReady and getDeployStatus commands for the AdminApp object to verify 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. If the system is not ready to start the application, the system might be expanding application binaries. A script that installs an application and then starts it typically would loop around a call to isAppReady until it returns a value of true before attempting to start the application.
For example, using Jython:
import time result = AdminApp.isAppReady('application1') while (result == "false"): ### Wait 5 seconds before checking again time.sleep(5) result = AdminApp.isAppReady('application1') print("Starting application...")Use Jacl:
set result [$AdminApp isAppReady application1] while {$result == "false"} { ### Wait 5 seconds before checking again after 5000 set result [$AdminApp isAppReady application1] } puts "Starting application..."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 examples display:
Use Jython:
print AdminApp.getDeployStatus('application1')Using Jacl:$AdminApp getDeployStatus application1Running the getDeployStatus command where application1 is DefaultApplication results in status information about DefaultApplication resembling the following:
ADMA5071I: Distribution status check started for application DefaultApplication. WebSphere:cell=myCell01,node=myNode01,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=myNode01,distribution=unknown,expansion=unknown
Starting servers using scripting Install enterprise application files with the console Automating application configurations wsadmin AdminApp Synchronize nodes startManager command Application installation and uninstallation scripts Commands for the AdminApp object Options for the AdminApp object install, installInteractive, edit, editInteractive, update, and updateInteractive commands Example: Obtaining option information for AdminApp object commands