add-library

Adds one or more library JAR files to Payara Server

Synopsis

asadmin [asadmin-options]
add-library
[--help]
[--type={common|ext|app}]
[--upload={false|true}]
[library-file-path ...]

Description

The add-library subcommand adds one or more library archive files to Payara Server.

The --type option specifies the library type and the Payara Server directory to which the library is added.

The library-file-path operand is the path to the JAR file that contains the library to be added.To specify multiple libraries, specify multiple paths separated by spaces.

The library archive file is added to the DAS. For common and extension libraries, you must restart the DAS so the libraries are picked up by the server runtime.

To add the libraries to other server instances, synchronize the instances with the DAS by restarting them.

This subcommand is supported in remote mode only.

Options

asadmin-options

Options for the asadmin utility. For information about these options, see the asadmin help page.

--help
-?

Displays the help text for the subcommand.

--type

Specifies the library type and the Payara Server directory to which the library is added. Valid values are as follows:

common

Adds the library files to the Common class loader directory, domain-dir/lib. This is the default.

ext

Adds the library files to the Java optional package directory, domain-dir/lib/ext.

app

Adds the library files to the application-specific class loader directory, domain-dir/lib/applibs.

For more information about these directories, see Class Loaders in the Payara Server Application Development section.

--upload

Specifies whether the subcommand uploads the file to the DAS. In most situations, this option can be omitted.

If a directory filepath is specified, this option is ignored.

Valid values are as follows:

false

The subcommand does not upload the file and attempts to access the file through the specified file name. If the DAS cannot access the file, the subcommand fails.

For example, the DAS might be running as a different user than the administration user and does not have read access to the file. In this situation, the subcommand fails if the --upload option is false.

true

The subcommand uploads the file to the DAS over the network connection.

The default value depends on whether the DAS is on the host where the subcommand is run or is on a remote host.

  • If the DAS is on the host where the subcommand is run, the default is false.

  • If the DAS is on a remote host, the default is true.

Operands

library-file-path

The paths to the archive files that contain the libraries that are to be added. You can specify an absolute path or a relative path.
If the --upload option is set to true, this is the path to the file on the local client machine. If the --upload option is set to false, this is the path to the file on the server machine.

Examples

Example 1 Adding Libraries

This example adds the library in the archive file mylib.jar to the application-specific class loader directory on the default server instance.

asadmin add-library --type app /tmp/mylib.jar
Command add-library executed successfully.

Exit Status

0

subcommand executed successfully

1

error in executing the subcommand

See Also