Installing enterprise applications using wsadmin scripting
Use the AdminApp object or the AdminApplication script library to install an application to the application server run time. You can install an enterprise archive file (EAR), web application archive (WAR) file, servlet archive (SAR), or Java™ archive (JAR) file.
Before you begin
On a single server installation, verify that the server is running before you install an application. Use the startServer command utility to start the server.
The scripting library provides a set of procedures to automate the most common administration functions. You can run each script procedure individually, or combine several procedures to quickly develop new scripts.
About this task
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 the wsadmin tool 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.
Procedure
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. You cannot start the application until the system extracts all binary files. 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. 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.
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...")
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:
print AdminApp.getDeployStatus('application1')
Using
Jacl:$AdminApp getDeployStatus application1
Running 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