creates the resources specified in an XML file


add-resources [--help] [--target target] 
[--upload={false|true}] xml-file-name


The add-resources subcommand creates the resources named in the specified XML file. The resources that can be created with this subcommand are listed in See Also in this help page.

The --target option specifies the target for which you are creating the resources. If this option specifies the domain, the resources are added only to the configuration of the domain administration server (DAS). If this option specifies any other target, the resources are added to the configuration of the DAS and references are added to the resources from the specified target.

The xml-file-name operand is the path to the XML file that contains the resources to be created. The DOCTYPE must be specified as in the resources.xml file.

This subcommand is supported in remote mode only.



Displays the help text for the subcommand.


Specifies the target for which you are creating the resources.

Valid values are as follows:


Creates the resources for the default server instance server and is the default value.


Creates the resources for the domain.


Creates the resources for every server instance in the cluster.


Creates the resources for a particular GlassFish Server instance.


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

Valid values are as follows:


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.


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.



The path to the XML file that contains the resources that are to be created. You can specify an absolute path, only the file name, or a relative path.

  • If you specify an absolute path, the XML file can be anywhere.

  • If you specify only the file name, the XML file must reside in the domain-dir/config directory on the DAS host. This requirement must be met even if you run the subcommand from another host.

  • If you specify a relative path, the XML file must be in the relative directory.

An example XML file follows.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC 
   "-// GlassFish Application Server 3.1 Resource Definitions //EN" 
 <jdbc-connection-pool name="SPECjPool" steady-pool-size="100" 
   max-pool-size="150" max-wait-time-in-millis="60000" 
   pool-resize-quantity="2" idle-timeout-in-seconds="300" 
  <property name="URL" 
  <property name="User" value="spec"/>
  <property name="Password" value="spec"/>
  <property name="MaxStatements" value="200"/>
  <property name="ImplicitCachingEnabled" value="true"/>
 <jdbc-resource enabled="true" pool-name="SPECjPool" 


Example 1   Adding Resources

This example creates resources using the contents of the XML file resource.xml.

asadmin> add-resources resource.xml
Command : Connector connection pool jms/testQFactoryPool created.
Command : Administered object jms/testQ created.
Command : Connector resource jms/testQFactory created.
Command : Resource adapter config myResAdapterConfig created successfully
Command : JDBC connection pool DerbyPoolA created successfully.
Command : JDBC resource jdbc/__defaultA created successfully.
Command add-resources executed successfully.

Exit Status


subcommand executed successfully


error in executing the subcommand

See Also

create-jdbc-connection-pool(1),create-jdbc-resource(1), create-jms-resource(1), create-jndi-resource(1), create-javamail-resource(1), create-custom-resource(1), create-connector-resource(1), create-connector-work-security-map(1), create-admin-object(1), create-resource-adapter-config(1)