WAS v8.5 > Script the application serving environment (wsadmin) > Administer applications using wsadmin.sh

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 JAR file.

On a single server installation, verify the server is running before you install an application. Use the startServer command utility to start the server.

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 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 JAR file. The archive file must end in .ear, .jar, .sar or .war for wsadmin 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 when installing applications to mixed-version environments to ensure the most recent wsadmin options and commands are available..

  1. Start the wsadmin scripting tool.

  2. Determine which options to use to install the application in your configuration.

    For example, if your configuration consists of a node, a cell, and a server, we can specify that information when we 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 using wsadmin.sh 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]')

    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:

    Jython:

      print AdminApp.options()

    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 your install or installinteractive command with on the options you chose based on your configuration.

    • Using the install command to install the application in batch mode:

      • For a single server installation only, the following example uses the EAR file and the command option information to install the application:

        • Jython string:

            AdminApp.install('c:/MyStuff/application1.ear', '[-server serv2]')
        • Jython list:

            AdminApp.install('c:/MyStuff/application1.ear', ['-server', 'serv2'])
        • Jacl:

            $AdminApp install "c:/MyStuff/application1.ear" {-server serv2}

        install server command elements. Run the install command with the -server option.

        Element Description
        $ is a Jacl operator for substituting a variable name with its value
        AdminApp is an object supporting application object management
        install is an AdminApp command
        MyStuff/application1.ear is the name of the application to install
        server is an installation option
        serv2 is the value of the server option

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

          AdminApp.installInteractive('c:/MyStuff/application1.ear')
      • Jacl:

          $AdminApp installInteractive "c:/MyStuff/application1.ear"

      installInteractive command elements. Run the installInteractive command with the name of the application to install.

      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 your configuration changes:

The steps in this task return a success message if the system successfully installs the application. When installing 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 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. For example, using Jython:

Using Jacl:

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


Start servers using scripting
Install enterprise application files with the console
Automating application configuration
Use the wsadmin scripting AdminApp object for scripted administration


Reference:

Application installation and uninstallation scripts
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


+

Search Tips   |   Advanced Search