Sun GlassFish Enterprise Server 2.1 Administration Guide

The asadmin Utility

Use the asadmin utility to perform any administrative tasks for the Application Server. You can use this asadmin utility in place of using the Administrator interface.

The asadmin utility invokes subcommands that identify the operation or task you wish to perform. Subcommands are case-sensitive. Short option arguments have a single dash (-); while long option arguments have two dashes (--). Options control how the utility performs a subcommand. Options are also case-sensitive. Most options require argument values except boolean options which toggle to switch a feature ON or OFF. Operands appear after the argument values, and are set off by a space, a tab, or double dashes (--). The asadmin utility treats anything that comes after the options and their values as an operand.

asadmin can be used in command shell invocation or multi command mode (known as multimode). In command shell invocation you invoke the asadmin utility from your command shell. asadmin executes the command, then exits. In multiple command mode, you invoke asadmin once, it then accepts multiple commands until you exit asadmin and return to the normal command shell invocation. Environment variables set while in multiple command mode are used for all subsequent commands until you exit multimode. You may provide commands by passing a previously prepared list of commands from a file or standard input (pipe). Additionally, you can invoke multimode from within a multimode session; once you exit the second multimode environment, you return to your original multimode environment.

You can also run the asadmin utility in interactive or non-interactive options. By default, the interactive option is enabled. It prompts you for the required arguments. You can use the interactive option in command shell invocation under all circumstances. You can use the interactive option in multimode when you run one subcommand at a time from the command prompt; and when you run in multimode from a file. Subcommands in multimode, when piped from an input stream, and subcommands invoked from another program, cannot run in the interactive option.

Local subcommands can be executed without the presence of an administration server. However, it is required that the user be logged into the machine hosting the domain in order to execute the subcommand and have access (permissions) for the installation and domain directories. Remote subcommands are always executed by connecting to an administration server and executing the subcommand there. A running administration server is required. All remote subcommands require the following options:

For subcommands that can be executed locally or remotely, if any one of the--host, --port, --user, and --passwordfile options are set, either in the environment or in the command line, the subcommand will run in remote mode. Additionally, for subcommands that can be executed locally or remotely, if the --local option is set to true, the subcommand will run locally. Also, if none of the local options are set, either on the command line or in the environment, the subcommand is executed locally by default. Setting the --local option to true overrides the local --host, --port, --user, and --passwordfile settings, even if specified. The subcommand will run in local mode.

Subcommands that can be executed locally accept the --domain option to specify the domain of interest which assumes the domain as the default domain if there is only one. If there is more than one domain, the --domain option is a required option. For subcommands that can be run locally or remotely, when run remotely with the--host, --port, --user, and --passwordfile options specified, the --domain option is ignored. The --domain option is ignored if the subcommand will be run in remote mode. Note that there is one administration instance per domain, so on a single machine with multiple domains, local execution must specify the domain, and remote execution must specify the --host, --port, --user, and --passwordfile options for the administration instance for that domain.

For security purposes, you can set the password for a subcommand from a file instead of entering the password at the command line. The --passwordfile option takes the file containing the passwords. The valid contents for the file are:

Example C–1 Passwordfile contents


If AS_ADMIN_PASSWORD has been exported to the global environment, specifying the --passwordfile option will produce a warning about using the --password option. Unset AS_ADMIN_PASSWORD to prevent this from happening. The master password is not propagated on the command line or an environment variable, but can be specified in the passwordfile.

To use the --secure option, you must use the set command to enable the security --enabled flag in the admin http-listener in the domain.xml. When you use the asadmin subcommands to create and/or delete, you must restart the server for the newly created command to take affect. Use the start-domain command to restart the server.

To access the manpages for the Application Server command-line interface subcommands on the Solaris platform, add $AS_INSTALL/man to your MANPATH environment variable.

You can obtain overall usage information for any of the asadmin utility subcommands by invoking the --help option. If you specify a subcommand, the usage information for that subcommand is displayed. Using the --helpoption without a subcommand displays a listing of all the available subcommands.