Install enterprise applications

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), WAR file, servlet archive (SAR), or JAR file.

On a network deployment installation, verify that the deployment manager is running before you 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 WAR file, a servlet archive (SAR), or a 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.

Best practice: 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

  1. Start the wsadmin scripting tool.

  2. 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, use the following command examples:

    Jython:

      AdminApp.install('location_of_ear.ear','[-node nodeName -cell cellName -server serverName]')

    Using Jacl:

      $AdminApp install "location_of_ear.ear" {-node nodeName -cell cellName -server serverName}

    We can also obtain a list of supported options for an EAR file using the options command, for example:

    Using Jython:

      print AdminApp.options()

    Using Jacl:

      $AdminApp options

    We 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.

    We can 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.

  3. 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 you chose to use for the installation in the previous step.

  4. 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 the install or installinteractive command with on the options you 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
        $ is a Jacl operator for substituting a variable name with its value
        AdminApp is an object allowing application objects to be managed
        install is an AdminApp command
        MyStuff/application1.ear is the name of the application to install
        cluster is an 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"

      the installInteractive command with the name of
      Element Description
      $ is a Jacl operator for substituting a variable name with its value
      AdminApp is an object allowing application objects to be managed
      installInteractive is an AdminApp command
      MyStuff/application1.ear is the name of the application to install

  5. Save the configuration changes.

    Use the following command example to save the configuration changes:

  6. 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 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.

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...")

Using 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:

Jython:

Using Jacl:

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


Related tasks

  • Start servers
  • Install enterprise application files with the console
  • Automating application configurations
  • Use the wsadmin scripting AdminApp object for scripted administration
  • Synchronize nodes using wsdmin.sh

  • 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