Oracle GlassFish Server Reference Manual Release 3.1.2 Part Number E24938-01 |
|
|
View PDF |
adds one or more library JAR files to GlassFish Server
add-library [--help] [--type={common|ext|app}] [--upload={false|true}] library-file-path [library-file-path ... ]
The add-library
subcommand adds one or more library archive files to GlassFish Server.
The --type
option specifies the library type and the GlassFish 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.
Note:
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.
--help
-?
Displays the help text for the subcommand.
--type
Specifies the library type and the GlassFish 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 Oracle GlassFish Server Application Development Guide.
--upload
Specifies whether the subcommand uploads the file to the DAS. In most situations, this option can be omitted.
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
.
If a directory filepath is specified, this option is ignored.
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.
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.
subcommand executed successfully
error in executing the subcommand
remove-library(1), list-libraries(1)
"Class Loaders" in Oracle GlassFish Server Application Development Guide