Payara Server Management Asadmin Commands

This is a non-exhaustive list of asadmin commands for Payara Server.

start-domain

Usage

asadmin> start-domain <options> <domain>

Aim

This command starts the specified domain

Options Type Description Default Mandatory

--verbose

Boolean

Starts the domain in verbose mode

false

No

--upgrade

Boolean

false

No

--watchdog

Boolean

false

No

--dry-run

Boolean

false

No

--drop-interrupted-commands

Boolean

false

No

--prebootcommandfile

String

Path to file containing commands to run before booting the server. Only a limited amount of commands will work at this point

No

--postbootcommandfile

String

Path to file containing commands to run after the server is booted.

No

start-domains

Usage

asadmin> start-domains <list of domains>

Aim

This command can be used to start the specified list of domains in the operand. This list must be specified as a comma separated string of values.

The domains will be started assuming default values for all options you would specify when running the start-domain command against one domain (default domain directory, debug mode off, verbose mode off, etc.)

Command Options

No command options available.

Example

To start the domain1 and production domains, run the following command:

asadmin> start-domains domain1, production

stop-domains

Usage

asadmin> stop-domains <list of domains>

Aim

This command can be used to stop the specified list of domains in the operand. This list must be specified as a comma separated string of values.

The domains will be stopped assuming default values for all options you would specify when running the stop-domain command against one domain (forced stopping and process killing)

Command Options

No command options available.

Example

To stop the domain1 and production domains, run the following command:

asadmin> stop-domains domain1, production

restart-domains

Usage

asadmin> restart-domains <list of domains>

Aim

This command can be used to restart the specified list of domains in the operand. This list must be specified as a comma separated string of values.

Command Options

No command options available.

Example

To restart the domain1 and production , run the following command:

asadmin> restart-domains domain1, production

stop-all-domains

Usage

asadmin> stop-all-domains

Aim

This command can be used to stop ALL current running domains on the server’s installation.

Command Options

Option Type Description Default Mandatory

--force

Boolean

Specifies whether each domain is forcibly stopped immediately.

true

No

--kill

Boolean

Specifies whether the domain is killed by using functionality of the operating system to terminate the domain process

false

No

Example

To forcibly stop all running domains, run the following command:

asadmin> stop-all-domains --force=false

backup-domain

Usage

asadmin> backup-domain <options> <domain_name>

Aim

This command performs a backup on the domain. The backup-domain command requires the domain being backed up to be stopped. Backups have the following naming scheme: domain-name_YYYY_MM_DD_backup-number

Options Type Description Default Mandatory

--long

Boolean

Displays detailed information about the backup operation

false

No

--description

String

A description to store in the backup zip

No

--domaindir

String

Specifies the domain root directory

~/payara5/glassfish/domains

No

--backupdir

String

Specifies the directory where the backup is to be stored

~/payara5/glassfish/domains/{domain_name}/backups

No

restore-domain

Usage

asadmin> restore-domain <options> <domain_name>

Aim

This command restores files under the domain name from a backup directory.

If a domain is restored on an already existing domain folder, all the files will be overwritten when the command is run.
Options Type Description Default Mandatory

--long

Boolean

Displays detailed information about the backup operation

false

No

--filename

String

The name of the backup file to use as the source

No

--domaindir

String

Specifies the domain root directory

~/payara5/glassfish/domains

No

--backupdir

String

Specifies the directory where the backup file is stored

~/payara5/glassfish/domains/{domain_name}/backups

No

--force

Boolean

Forces the restore-domain command to continue when the name of the domain to restore does not match the name of the domain in the backup file

false

No

start-instance

Usage

asadmin> start-instance instancename

Aim

This command can be used to start a specified instance of Payara Server, which can be either a local or remote instance. This command runs on the DAS.

Command Options

These are not the same options available for the start-local-instance command.
Option Type Description Default Mandatory

--sync

none|normal|full

Specifies whether the instance is to be synced with the DAS. In normal mode only config files and top-level application file are synced. In full all files are synced.

normal

No

--debug

Boolean

Specifies whether the instance is started in debug mode

false

No

--terse

Boolean

Specifies whether information on the result is output

false

No

--timeout

Integer

Specifies how long to take for the instance to start in seconds. If starting the instance takes longer than this amount then this command will fail

120

No

Using full synchronization will cause the configuration to be deleted if the DAS cannot be reached.

Example

To start an instance named instance1 and sync it with the DAS with a timeout of 180 seconds:

asadmin> start-instance --timeout 180 --sync true instance1

start-local-instance

Usage

asadmin> start-local-instance instancename

Aim

This command can be used to start a specified instance of Payara, but only when it corresponds to a local instance. A local instance is located in the same host from where the asadmin command is executed. This command is executed in "local" mode, which means that the DAS is not started in order to effectively execute it. Keep in mind that running the instance using the sync option has some nuances, so read the note below for more information.

Command Options

These are not the same as the options available for the start-instance command.
Option Type Description Default Mandatory

-v, --verbose

Boolean

Specifies that the server log is printed to the console from which asadmin is executed. Control is not returned to the console after the instance has started. The instance can be stopped and control returned by inputting CTRL-C.

false

No

-w, --watchdog

Boolean

Starts the server in watchdog mode. This is only useful if verbose is false. It does the same thing as verbose — except without the dumping of output to standard out and err streams.

false

No

-d, --debug

Boolean

Specifies whether the instance is started in debug mode

false

No

-n, --dry-run

Boolean

Specifies to dump the full human readable JVM invocation command that would be used to launch the instance instead of actually launching it.

false

No

--sync

none | normal | full

Specifies whether the instance is to be synced with the DAS. In normal mode only config files and top-level application file are synced. In full all files are synced.

normal

No

--nodedir

String

Specifies the folder on the local filesystem where the node the instance is in resides.

${PAYARA_INSTALL_DIR}/glassfish/nodes/.

No

--node

String

Specifies the node the instance is in.

The single folder inside the nodedir directory, in the case that there’s only a single folder.

No

If the node directory contains a single folder

Yes

Otherwise

--timeout

Integer

Specifies how long to take for the local instance to start in seconds. If starting the instance takes longer than this amount then this command will fail (but the instance may still continue its startup process…​)

600

No

Using full synchronization will cause the configuration to be deleted if the DAS cannot be reached.

Example

To start a local instance named instance1 with a timeout of 180 seconds:

asadmin> start-local-instance --timeout 180 instance1

add-library

Usage

asadmin> add-library <options> file

Aim

This command adds a JAR library to a Payara Server domain and immediately initiates makes it available for class loading.

Options

Type

Description

Default

Mandatory

--type

String

Specifies the type of library. The supported values are common, ext, app. If it’s of type app the server must be restarted to take effect

common

No

create-iiop-listener

Usage

asadmin > create-iiop-listener <options> listener_id

Aim

Creates a listener for IIOP network traffic

Command Options

Option

Type

Description

Default

Mandatory

--listeneraddress

String

Network address used to bind the listener

Yes

--iiopport

Integer

Port number to bind the listener

1072

No

--enabled

Boolean

Whether to enable the listener after its creation

true

No

--securityenabled

Boolean

Whether to enable the listener as a secure listener

false

No

--lazyInit

Boolean

Whether to lazily initialize the listener

false

No

--property

List<String>

Colon-separated list of properties to configure the listener

No

generate-bash-autocomplete

Usage

asadmin >generate-bash-autocomplete output_file

Aim

Creates an asadmin autocompletion script for bash.

The created file will be located in the server’s host and not the client. If they are on different hosts, then the file will be needed to copied from the server to the client. TIP: You can add the resulting file to your bash path by adding source path/to/outputfile to your .bashrc settings or copy the file into the /etc/bash_completion.d directory.

This means that you can run asadmin commands by typing asadmin in a terminal and you can use double-tab to autocomplete a command, similar to other bash commands.

Command Options

Option

Type

Description

Default

Mandatory

--force

Boolean

Whether to overwrite a script file if one already exists

false

No

--file

String

The path for the resulting file

${payara.home}/glassfish/bin/bash_autocomplete

No

--localCommands

Boolean

This option will include local asadmin commands

false

No

get-domain-xml

Usage

asadmin > get-domain-xml

Aim

Gets the text of the domain.xml configuration file.

This command will only run against a local instance.

list-rest-endpoints

Aim

Lists all the rest endpoints of a deployed web application

Usage

asadmin > list-rest-endpoints applicationName

restart-cluster

Aim

Restarts all instances in a cluster. Must be run from the DAS.

Usage

asadmin > restart-cluster clusterName

set-network-listener-configuration

Usage

asadmin> set-network-listener-configuration <options> network_listener_name

Aim

This command helps to modify an existing HTTP network listener

Options

Type

Description

Default

Mandatory

--enabled

Boolean

Enables or disables the network listener

true

No

--dynamic

Boolean

When set to true, applies the changes without a restart. Otherwise a restart is required for changes to apply

false

No

--address

String

The network address on which the network listener is going to be listening

No

--port

Integer

The port on which the network listener is going to be listening.

Yes

--listenerPortRange

String

Port range which the network listener can bind to.

No

--threadPool

String

The thread pool which will be associated with the network listener

No

--transport

String

The transport layer that is going to be used by the network listener

No

--jkenabled

Boolean

If enabled, the network listener will become an Apache mod-jk listener

false

No

--target

String

The configuration object whose values will be set.

server-config

No

restart-http-listeners

Usage

asadmin> restart-http-listeners <options>

Aim

This command restarts all http listeners of the targeted instance(s). Usually used to make network configuration changes take effect without restarting the server.

Options

Type

Description

Default

Mandatory

--all

Boolean

Apply command to all instances

false

No

--target

String

Name of the target instance, deployment group or cluster

server

No

This command only restarts all HTTP listeners except the admin-listener.
Examples

Run the following command to restart all HTTP network listeners that belong to all instances:

asadmin> restart-http-listeners --all

Run the following command to restart all HTTP network listeners that belong to a particular instance named FlyingFish:

asadmin> restart-http-listeners FlyingFish
The --target can be omitted as target is the primary parameter.

create-service

Usage

asadmin> create-service <options> <domain-or-instance-name>

Aim

Configures the starting of a DAS or a Payara Server instance on an unattended boot.

The create-service subcommand configures the starting of a domain administration server (DAS) or a Payara Server instance on an unattended boot on Windows, Linux, and Oracle Solaris systems.

If no operand is specified and the domains directory contains only one domain, the subcommand configures the starting of the DAS for the default domain. If no operand is specified and the domains directory contains multiple domains, an error occurs.

If the operand specifies an instance, the create-service subcommand does not contact the domain administration server (DAS) to determine the node on which the instance resides. To determine the node on which the instance resides, the subcommand searches the directory that contains the node directories. If multiple node directories exist, the node must be specified as an option of the subcommand.

The subcommand contains internal logic to determine whether the supplied operand is a DAS or an instance.

This subcommand is supported in local mode only.

Behaviour of create-service on Windows Systems

On Windows systems, this subcommand must be run as the OS-level administrator user and requires the Microsoft .NET Framework (http://www.microsoft.com/net/), otherwise, the subcommand fails. It creates a Windows service to represent the DAS or instance. The service is created in the disabled state. After this subcommand creates the service, you must use the Windows Services Manager or the Windows Services Wrapper to start, stop, uninstall, or install the service.

The subcommand creates the following Windows Services wrapper files for the service in the domain-dir\bin directory or the instance-dir\bin directory:

  • Configuration file: service-nameService.xml

  • Executable file: service-nameService.exe

Behaviour of create-service on Linux Systems

On Linux systems, the create-service subcommand first detects System-V or SystemD init systems.

On systems using System-V, it creates an initialization script /etc/init.d/payara_domain-or-instance-name and installs a link to this script in the /etc/rc?.d directories. After this subcommand creates the script, you must use this script to start, stop, or restart the domain or instance.

On systems using SystemD, the subcommand creates a configuration file payara_domainname.service in /etc/systemd/system. It is recommended to specify non-root user to run payara (parameter --serviceuser). It is possible to further configure the service via --serviceproperties.

On Linux systems, this subcommand must be run as the OS-level root user, because it writes to system directories.

Behavior of create-service on Oracle Solaris Systems

On Oracle Solaris systems, the create-service subcommand creates a Service Management Facility (SMF) service to represent the DAS or instance. The service is created in the disabled state. After this subcommand creates the service, you must use SMF commands to start, enable, disable, delete, or stop the service. For more information about SMF, see the following documentation for the Oracle Solaris operating system:

  • "Managing Services (Overview)" in System Administration Guide: Basic Administration

  • "Managing Services (Tasks)" in System Administration Guide: Basic Administration

On Oracle Solaris systems, this subcommand must be run as the OS-level user with superuser privileges. The configuration file for the DAS or instance must be stored in a directory to which the superuser has access and cannot be stored on a network file system. The service that is created is controlled by the OS-level user who owns the directory where the configuration of the DAS or instance resides.

On Oracle Solaris systems, the manifest file is created in the following directory by default:

/var/svc/manifest/application/GlassFish/domain-or-instance-name_domain-or-instance-root-dir
To run this subcommand, you must have solaris.smf.* authorization.

To run these commands as non-root user, the system administrator must be contacted so that the relevant authorizations are granted. You must also ensure that the following conditions are met:

  • Oracle Solaris 10 administration commands such as svccfg(1M), svcs(1), and auths(1) are available through the PATH statement, so that these commands can be executed. A simple test to do so is to run the command which svccfg in the shell.

  • You must have write permission for the path /var/svc/manifest/application/GlassFish. Usually, the superuser has write permission to this path.

If you delete a service that you created by using the create-service subcommand, you must delete the directory that contains the manifest file and the entire contents of the directory. Otherwise, an attempt to re-create the service by using the create-service subcommand fails. The Oracle Solaris command svccfg does not delete this directory.

Command Options

Operands Type Description Default Mandatory

domain-or-instance-name

string

The name of the domain or instance to configure. If no operand is specified, the default domain is used.

domain1

No

Options Type Description Default Mandatory

--help, -?

Displays the help text for the subcommand.

No

--name

string

(Windows and Oracle Solaris systems only) The name of the service that you will use when administering the service through Oracle Solaris SMF commands or the service management features of the Windows operating system.

Name of the domain or instance that is specified as the operand of this subcommand

No

--system-type

string

If specified, system-type must be one of systemd, systemv, solaris or windows, which determine the type of init scripts to create. If not specified, the command performs autodetection of init system.

Detected automatically

No

--serviceproperties

string

Specifies a colon(:)-separated list of various properties that are specific to the service. To customize the display name of the service in the Windows Service list, set the DISPLAY_NAME property to the required name. For Oracle Solaris 10 systems, if you specify net_privaddr, the service’s processes will be able to bind to the privileged ports (<1024) on the platform. You can bind to ports< 1024 only if the owner of the service is superuser, otherwise, this is not allowed. On Linux systems using SystemD these properties are stored as Environment entries, accessible via Microprofile property in the applications.

No

--dry-run, -n

boolean

Previews your attempt to create a service. Indicates issues and the outcome that will occur if you run the command without using the --dry-run option. Nothing is actually configured. Default is false.

false

No

--force

string

Specifies whether the service is created even if validation of the service fails. Possible values are as follows: true, The service is created even if validation of the service fails. false, The service is not created (default).

false

No

--serviceuser

string

(Linux systems only) The user that is to run Payara Server when the service is started. The default is the user that is running the subcommand. Specify this option if Payara Server is to be run by a user other than the root user.

root

No

--domaindir

string

The absolute path of the directory on the disk that contains the configuration of the domain. If this option is specified, the operand must specify a domain.

No

--nodedir

string

Specifies the directory that contains the instance’s node directory. The instance’s files are stored in the instance’s node directory. The default is as-install/nodes. If this option is specified, the operand must specify an instance.

No

--node

string

Specifies the node on which the instance resides. This option may be omitted only if the directory that the --nodedir option specifies contains only one node directory. Otherwise, this option is required. If this option is specified, the operand must specify an instance.

No

Examples

Example 1: Creating a Service on a Windows System

This example creates a service for the default domain on a system that is running Windows.

asadmin> create-service

Found the Windows Service and successfully uninstalled it.
The Windows Service was created successfully.  It is ready to be started.  Here are
the details:
ID of the service: domain1
Display Name of the service:domain1 Payara Server
Domain Directory: C:\\payara\\glassfish\\domains\\domain1
Configuration file for Windows Services Wrapper: C:\\payara\\glassfish\\domains\
domain1\\bin\\domain1Service.xml
The service can be controlled using the Windows Services Manager or you can use the
Windows Services Wrapper instead:
Start Command:  C:\\payara\\glassfish\\domains\\domain1\\bin\\domain1Service.exe  start
Stop Command:   C:\\payara\glassfish\\domains\\domain1\\bin\\domain1Service.exe  stop
Uninstall Command:  C:\\payara\\glassfish\\domains\\domain1\\bin\\domain1Service.exe
uninstall
Install Command:  C:\\payara\\glassfish\\domains\\domain1\\bin\\domain1Service.exe
install

This message is also available in a file named PlatformServices.log in the domain\'s
root directory

Command create-service executed successfully.

Example 2: Creating a Service on a Linux System using SystemD

This example creates a service for the default domain on a system that is running Linux and SystemD. It is necessary to inform SystemD about the new script by running systemctl daemon-reload. Then it is possible to start the service.

asadmin> create-service --service-user payaraadmin

The SystemD Service was created successfully. Here are the details:
Name of the service:domain1
Type of the service:Domain
Configuration location of the service:/etc/systemd/system/payara_domain1.service
User account that will run the service: payaraadmin
You have created the service but you need to start it yourself.  Here are the most
typical Linux commands of interest:

* systemctl daemon-reload
* systemctl start payara_domain1.service
* systemctl stop payara_domain1.service
* systemctl restart payara_domain1.service

For your convenience this message has also been saved to this file:
/opt/payara/glassfish/domains/domain1/PlatformServices.log

Command create-service executed successfully.

Example 3: Creating a Service on a Linux System using SystemV

This example creates a service for the default domain on a system that is running Linux and SystemV.

asadmin> create-service

Found the Linux Service and successfully uninstalled it.
The Service was created successfully. Here are the details:
Name of the service:domain1
Type of the service:Domain
Configuration location of the service:/etc/init.d/payara_domain1
User account that will run the service: root
You have created the service but you need to start it yourself.
Here are the most typical Linux commands of interest:

* /etc/init.d/payara_domain1 start
* /etc/init.d/payara_domain1 stop
* /etc/init.d/payara_domain1 restart

For your convenience this message has also been saved to this file:
/opt/payara/glassfish/domains/domain1/PlatformServices.log

Command create-service executed successfully.

Example 4: Creating a Service on an Oracle Solaris System

This example creates a service for the default domain on a system that is running Oracle Solaris.

asadmin> create-service

The Service was created successfully. Here are the details:
Name of the service:application/GlassFish/domain1
Type of the service:Domain
Configuration location of the service:/opt/payara/glassfish/domains
Manifest file location on the system:/var/svc/manifest/application
/GlassFish/domain1_opt_payara_glassfish_domains/Domain-service-smf.xml.
You have created the service but you need to start it yourself.
Here are the most typical Solaris commands of interest:
* /usr/bin/svcs -a | grep domain1 // status
* /usr/sbin/svcadm enable domain1 // start
* /usr/sbin/svcadm disable domain1 // stop
* /usr/sbin/svccfg delete domain1 // uninstall

Command create-service executed successfully.

_delete-service

Usage

asadmin> _delete-service <options> <domain-or-instance-name>

Aim

The _delete-service subcommand deletes scripts created by the subcommand create-service.

If no operand is specified and the domains directory contains only one domain, the subcommand deletes the script that starts the DAS for the default domain. If no operand is specified and the domains directory contains multiple domains, an error occurs.

The subcommand contains internal logic to determine whether the supplied operand is a DAS or an instance.

This subcommand is supported in local mode only.

Command Options

Operands Type Description Default Mandatory

domain-or-instance-name

string

The name of the domain or instance to configure. If no operand is specified, the default domain is used.

domain1

No

Example: Deleting a Service on a Linux System using SystemD init.

This example deletes a service for the default domain on a system that is running Linux and SystemD. It is necessary to inform SystemD about deleting the script by running systemctl daemon-reload.

asadmin> _delete-service
Command _delete-service executed successfully.