2.18.2 create-jndi-resource
Registers a JNDI resource.
Synopsis
asadmin [asadmin-options] create-jndi-resource [--help] [--target target] --restype restype --factoryclass factoryclass --jndilookupname jndilookupname [--enabled={true|false}] [--description description] jndi-name
Storage location
Application Server installation directory/javaee/glassfish/bin
Function
The create-jndi-resource subcommand registers a JNDI resource.
This command is supported in remote mode only.
Precondition
DAS has to be in a running state.
Arguments
- --help | -?
-
Displays the help text for the subcommand.
- --target target
-
Specifies the target for which you are registering a JNDI resource.
The resource is always created for the domain as a whole but the resource-ref for the resource is only created for the specified --target. This means that although the resource is defined at the domain level, it is only available at the specified target level. Use the create-resource-ref subcommand to refer to the resource in multiple targets if required.
Type: String
The following values can be specified:
-
server
Creates the resource for the default server instance. This is the default value.
-
domain
Creates the resource for the domain.
-
cluster-name
Creates the resource for every server instance in the cluster.
-
instance-name
Creates the resource for a particular server instance.
Default value: server
-
- --restype restype
-
Displays the JNDI resource type.
Type: String
The following values can be specified:
-
topic
-
queue
Default value: N/A
-
- --factoryclass factoryclass
-
Displays the class that creates the JNDI resource.
Type: String
The following values can be specified:
-
A class name implementing the javax.naming.spi.InitialContextFactory interface.
Default value: N/A
-
- --jndilookupname jndilookupname
-
Displays the lookup name that the external container uses.
Type: String
The following values can be specified:
-
Specify the jndi lookup name
Default value: N/A
-
- --enabled={true|false}
-
Determines whether the resource is enabled at runtime.
Type: Boolean
The following values can be specified:
-
true
-
false
Default value: true
-
- --description description
-
Provides details about the JNDI resource.
Type: String
The following values can be specified:
-
Text description
Default value: N/A
-
- jndi-name
-
Displays the unique name of the JNDI resource to be created.
Type: String
The following values can be specified:
-
Specify the JNDI name
Default value: N/A
-
Examples
The following example creates a JNDI resource on the server instance instance1.
asadmin create-jndi-resource --target instance1 --restype com.example.jndi.MyResourceType --factoryclass com.example.jndi.MyInitialContextFactoryClass --jndilookupname remote-jndi-name --description "sample JNDI resource" my-jndi-resource
Exit Status
Exit Status |
Explanation |
---|---|
0 |
command executed successfully. |
1 |
error in executing the command. |