Skip Headers
Oracle GlassFish Server Reference Manual
Release 3.1.2

Part Number E24938-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

asadmin

utility for performing administrative tasks for Oracle GlassFish Server

Synopsis

asadmin [--host host] 
[--port port] 
[--user admin-user] 
[--passwordfile filename] 
[--terse={true|false}] 
[--secure={false|true}] 
[--echo={true|false}] 
[--interactive={true|false}] 
[--help] 
[subcommand [options] [operands]]

Description

Use the asadmin utility to perform administrative tasks for Oracle GlassFish Server. You can use this utility instead of the Administration Console interface.

Subcommands of the asadmin Utility

The subcommand identifies the operation or task that you are performing. Subcommands are case-sensitive. Each subcommand is either a local subcommand or a remote subcommand.

asadmin Utility Options and Subcommand Options

Options control the behavior of the asadmin utility and its subcommands. Options are also case-sensitive.

The asadmin utility has the following types of options:

A subcommand option may have the same name as an asadmin utility option, but the effects of the two options are different.

The asadmin utility options and some subcommand options have a long form and a short form.

For example, the long form and the short form of the option for specifying terse output are as follows:

Most options require argument values, except Boolean options, which toggle to enable or disable a feature.

Operands of asadmin Subcommands

Operands specify the items on which the subcommand is to act. Operands must follow the argument values of subcommand options, and are set off by a space, a tab, or double dashes (--). The asadmin utility treats anything that follows the subcommand options and their values as an operand.

Escape Characters in Options for the asadmin Utility

Escape characters are required in options of the asadmin utility for the following types of characters:

Instead of using the backslash (\) escape character, you can use the double quote (") character or single quote (') character. The effects of the different types of quote characters on the backslash (\) character are as follows:

Requirements for Using the --secure Option

The requirements for using the --secure option are as follows:

Server Restart After Creation or Deletion

When you use the asadmin subcommands to create or delete a configuration item, you must restart the DAS for the change to take effect. To restart the DAS, use the restart-domain(1) subcommand.

Help Information for Subcommands and the asadmin Utility

To obtain help information for an asadmin utility subcommand, specify the subcommand of interest as the operand of the help subcommand. For example, to obtain help information for the start-domain(1) subcommand, type:

asadmin help start-domain

If you run the help subcommand without an operand, this help information for the asadmin utility is displayed.

To obtain a listing of available asadmin subcommands, use the list-commands(1) subcommand.

Options

--host
-H

The machine name where the DAS is running. The default value is localhost.

--port
-p

The HTTP port or HTTPS port for administration. This port is the port in the URL that you specify in your web browser to manage the domain. For example, in the URL http://localhost:4949, the port is 4949.

The default port number for administration is 4848.

--user
-u

The user name of the authorized administrative user of the DAS.

If you have authenticated to a domain by using the asadmin login command, you need not specify the --user option for subsequent operations on the domain.

--passwordfile
-W

Specifies the name, including the full path, of a file that contains password entries in a specific format.

The entry for a password must have the AS_ADMIN_ prefix followed by the password name in uppercase letters, an equals sign, and the password.

The entries in the file that are read by the asadmin utility are as follows:

  • AS_ADMIN_PASSWORD=administration-password

  • AS_ADMIN_MASTERPASSWORD=master-password

The entries in this file that are read by subcommands are as follows:

These password entries are stored in clear text in the password file. To provide additional security, the create-password-alias subcommand can be used to create aliases for passwords that are used by remote subcommands. The password for which the alias is created is stored in an encrypted form. If an alias exists for a password, the alias is specified in the entry for the password as follows:

AS_ADMIN_password-name=${ALIAS=password-alias-name} 

For example:

AS_ADMIN_SSHPASSWORD=${ALIAS=ssh-password-alias}
AS_ADMIN_SSHKEYPASSPHRASE=${ALIAS=ssh-key-passphrase-alias}

In domains that do not allow unauthenticated login, all remote subcommands must specify the administration password to authenticate to the DAS. The password can be specified by one of the following means:

  • Through the --passwordfile option

  • Through the login(1) subcommand

  • Interactively at the command prompt

The login subcommand can be used to specify only the administration password. For other passwords that remote subcommands require, use the --passwordfile option or specify them at the command prompt.

After authenticating to a domain by using the asadmin login command, you need not specify the administration password through the --passwordfile option for subsequent operations on the domain. However, only the AS_ADMIN_PASSWORD option is not required. You still must provide the other passwords, for example, AS_ADMIN_USERPASSWORD, when required by individual subcommands, such as update-file-user(1).

For security reasons, a password that is specified as an environment variable is not read by the asadmin utility.

The master password is not propagated on the command line or an environment variable, but can be specified in the file that the --passwordfile option specifies.

The default value for AS_ADMIN_MASTERPASSWORD is changeit.

--terse
-t

If true, output data is very concise and in a format that is optimized for use in scripts instead of for reading by humans. Typically, descriptive text and detailed status messages are also omitted from the output data. Default is false.

--secure
-s

If set to true, uses SSL/TLS to communicate with the DAS.

The default is false.

--echo
-e

If set to true, the command-line statement is echoed on the standard output. Default is false.

--interactive
-I

If set to true, only the required options are prompted.

The default depends on how the asadmin utility is run:

  • If the asadmin utility is run from a console window, the default is true.

  • If the asadmin utility is run without a console window, for example, from within a script, the default is false.

--help
-?

Displays the help text for the asadmin utility.

Examples

Example 1   Running an asadmin Utility Subcommand in Single Mode

This example runs the list-applications(1) subcommand in single mode. In this example, the default values for all options are used.

The example shows that the application hello is deployed on the local host.

asadmin list-applications
hello <web>

Command list-applications executed successfully.
Example 2   Specifying an asadmin Utility Option With a Subcommand

This example specifies the --host asadmin utility option with the list-applications subcommand in single mode. In this example, the DAS is running on the host srvr1.example.com.

The example shows that the applications basic-ezcomp, scrumtoys, ejb31-war, and automatic-timer-ejb are deployed on the host srvr1.example.com.

asadmin --host srvr1.example.com list-applications
basic-ezcomp <web>
scrumtoys <web>
ejb31-war <ejb, web>
automatic-timer-ejb <ejb>

Command list-applications executed successfully.
Example 3   Specifying an asadmin Utility Option and a Subcommand Option

This example specifies the --host asadmin utility option and the --type subcommand option with the list-applications subcommand in single mode. In this example, the DAS is running on the host srvr1.example.com and applications of type web are to be listed.

asadmin --host srvr1.example.com list-applications --type web
basic-ezcomp <web>
scrumtoys <web>
ejb31-war <ejb, web>

Command list-applications executed successfully.
Example 4   Escaping a Command-Line Argument With Single Quote Characters

The commands in this example specify the backslash (\) UNIX operating system meta character and the colon (:) option delimiter in the property value c:\extras\pmdapp.

For the UNIX operating system in single mode and multimode, and for all operating systems in multimode, the backslash (\) is required to escape the backslash (\) meta character and the colon (:) option delimiter:

asadmin deploy --property extras.home='c\:\\extras\\pmdapp' pmdapp.war
Application deployed with name pmdapp.
Command deploy executed successfully

For the Windows operating system in single mode, the single quote (') characters eliminate the need for other escape characters:

asadmin deploy --property extras.home='c:\extras\pmdapp' pmdapp.war
Application deployed with name pmdapp.
Command deploy executed successfully
Example 5   Specifying a UNIX Operating System Meta Character in an Option

The commands in this example specify the backslash (\) UNIX operating system meta character in the option argument Test\Escape\Character.

For the UNIX operating system in single mode and multimode, and for all operating systems in multimode, the backslash (\) is required to escape the backslash (\) meta character:

asadmin --user admin --passwordfile gfpass create-jdbc-connection-pool 
--datasourceclassname sampleClassName 
--description Test\\Escape\\Character 
sampleJDBCConnectionPool

For the Windows operating system in single mode, no escape character is required:

asadmin --user admin --passwordfile gfpass create-jdbc-connection-pool 
--datasourceclassname sampleClassName 
--description Test\Escape\Character 
sampleJDBCConnectionPool
Example 6   Specifying a Command-Line Argument That Contains a Space

The commands in this example specify spaces in the operand C:\Documents and Settings\gfuser\apps\hello.war.

For all operating systems in single mode or multimode, the entire operand can be enclosed in double quote (") characters:

asadmin deploy "C:\Documents and Settings\gfuser\apps\hello.war"
Application deployed with name hello.
Command deploy executed successfully.

For the UNIX operating system in single mode and multimode, and for all operating systems in multimode, the entire command-line argument can be enclosed in single quote (') characters:

asadmin> deploy 'C:\Documents and Settings\gfuser\apps\hello.war'
Application deployed with name hello.
Command deploy executed successfully.

Alternatively, for the UNIX operating system in single mode and multimode, and for all operating systems in multimode, the backslash (\) escape character can be used before each space in the operand. In this situation, the backslash (\) escape character is required before each backslash in the operand:

asadmin> deploy C:\\Documents\ and\ Settings\\gfuser\\apps\\hello.war
Application deployed with name hello.
Command deploy executed successfully.
Example 7   Specifying a Meta Character and an Option Delimiter Character in a Property

The commands in this example specify the backslash (\) UNIX operating system meta character and the colon (:) option delimiter character in the --property option of the create-jdbc-connection-pool(1) subcommand.

The name and value pairs for the --property option are as follows:

user=dbuser
passwordfile=dbpasswordfile
DatabaseName=jdbc:derby
server=http://localhost:9092

For the UNIX operating system in single mode and multimode, and for all operating systems in multimode, a backslash (\) is required to escape the colon (:) and the backslash (\):

asadmin --user admin --passwordfile gfpass create-jdbc-connection-pool 
--datasourceclassname com.derby.jdbc.jdbcDataSource
--property user=dbuser:passwordfile=dbpasswordfile:
DatabaseName=jdbc\\:derby:server=http\\://localhost\\:9092 javadb-pool

Alternatively, the entire argument to the --property option can be enclosed in single quote (') characters:

asadmin --user admin --passwordfile gfpass create-jdbc-connection-pool 
--datasourceclassname com.derby.jdbc.jdbcDataSource
--property 'user=dbuser:passwordfile=dbpasswordfile:
DatabaseName="jdbc:derby":server="http://localhost:9092"' javadb-pool

For the Windows operating system in single mode, a backslash (\) is required to escape only the colon (:), but not the backslash (\):

asadmin --user admin --passwordfile gfpass create-jdbc-connection-pool
--datasourceclassname com.derby.jdbc.jdbcDataSource
--property user-dbuser:passwordfile-dbpasswordfile:
DatabaseName=jdbc\:derby:server=http\://localhost\:9092 javadb-pool

For all operating systems, the need to escape the colon (:) in a value can be avoided by enclosing the value in double quote characters or single quote characters:

asadmin --user admin --passwordfile gfpass create-jdbc-connection-pool
--datasourceclassname com.derby.jdbc.jdbcDataSource
--property user=dbuser:passwordfile=dbpasswordfile:
DatabaseName=\"jdbc:derby\":server=\"http://localhost:9092\" javadb-pool
Example 8   Specifying an Option Delimiter and an Escape Character in a JVM Machine Option

The commands in this example specify the following characters in the -Dlocation=c:\sun\appserver JVM machine option:

  • The colon (:) option delimiter

  • The backslash (\) escape character

For the UNIX operating system in single mode and multimode, and for all operating systems in multimode, these characters must be specified as follows:

  • To pass a literal backslash to a subcommand, two backslashes are required. Therefore, the colon (:) must be escaped by two backslashes (\\).

  • To prevent the subcommand from treating the backslash as a special character, the backslash must be escaped. As a result, two literal backslashes (\\) must be passed to the subcommand. To prevent the shell from interpreting these backslashes as special characters, each backslash must be escaped. Therefore, the backslash must be specified by a total of four backslashes (\\\\).

The resulting command is as follows:

asadmin create-jvm-options --target test-server 
-e -Dlocation=c\\:\\\\sun\\\\appserver

For the Windows operating system in single mode, a backslash (\) is required to escape the colon (:) and the backslash (\):

asadmin create-jvm-options --target test-server 
-e -Dlocation=c\:\\sun\\appserver
Example 9   Specifying an Option That Contains an Escape Character

The commands in this example specify the backslash (\) character and the double quote (") characters in the "Hello\App"\authentication option argument.

For the UNIX operating system in single mode and multimode, and for all operating systems in multimode, a backslash (\) is required to escape the double quote character (") and the backslash (\):

asadmin set-web-env-entry --name="Hello User" --type=java.lang.String 
--value=techscribe --description=\"Hello\\App\"\\authentication hello

For the Windows operating system in single mode, a backslash (\) is required to escape only the double quote ("), but not the backslash (\):

asadmin set-web-env-entry --name="Hello User" --type=java.lang.String 
--value=techscribe --description=\"Hello\App\"\authentication hello

Environment Variables

Environment variables modify the default values of asadmin utility options as shown in the following table.

Environment Variable asadmin Utility Option

AS_ADMIN_TERSE

--terse

AS_ADMIN_ECHO

--echo

AS_ADMIN_INTERACTIVE

--interactive

AS_ADMIN_HOST

--host

AS_ADMIN_PORT

--port

AS_ADMIN_SECURE

--secure

AS_ADMIN_USER

--user

AS_ADMIN_PASSWORDFILE

--passwordfile

AS_ADMIN_HELP

--help


Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE

Interface Stability

Unstable


See Also

configure-jms-cluster(1), create-connector-security-map(1), create-file-user(1), create-jdbc-connection-pool(1), create-jvm-options(1), create-node-dcom(1), create-node-ssh(1), create-password-alias(1), deploy(1), install-node(1), install-node-dcom(1), install-node-ssh(1), list-applications(1), list-commands(1), login(1), restart-domain(1), set(1), set-web-env-entry(1), start-domain(1), update-file-user(1), update-node-dcom(1), update-node-ssh(1)

attributes(5)



Footnote Legend

Footnote 1: The terms "Java Virtual Machine" and "JVM" mean a Virtual Machine for the Java platform.