Loading...

Using the CLI in JBoss

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

This post describes the basic concepts of the JBoss command line interface. It may enhance the work with the CLI.

Query the version of JBoss

[standalone@localhost:9999 /] version
JBoss Admin Command-line Interface
JBOSS_HOME: C:\dev\app-server\jboss-eap-6.4
JBoss AS release: 7.5.0.Final-redhat-21 "Janus"
JBoss AS product: EAP 6.4.0.GA
JAVA_HOME: C:\Program Files\Java\jdk1.8.0_66
java.version: 1.8.0_66
java.vm.vendor: Oracle Corporation
java.vm.version: 25.66-b17
os.name: Windows 7
os.version: 6.1

List available JDBC drivers (as default the H2 database is shipped within).

[standalone@localhost:9999 /] jdbc-driver-info
NAME SOURCE
h2   com.h2database.h2/main

List content

[standalone@localhost:9999 /] ls
core-service                           management-minor-version=7
deployment                             name=cinhtau
deployment-overlay                     namespaces=[]
extension                              process-type=Server
interface                              product-name=EAP
path                                   product-version=6.4.0.GA
socket-binding-group                   profile-name=undefined
subsystem                              release-codename=Janus
system-property                        release-version=7.5.0.Final-redhat-21
launch-type=STANDALONE                 running-mode=NORMAL
management-major-version=1             schema-locations=[]
management-micro-version=0             server-state=running

You can traverse into the nodes

[standalone@localhost:9999 /] ls
core-service                           management-minor-version=7
deployment                             name=cinhtau
deployment-overlay                     namespaces=[]
extension                              process-type=Server
interface                              product-name=EAP
path                                   product-version=6.4.0.GA
socket-binding-group                   profile-name=undefined
subsystem                              release-codename=Janus
system-property                        release-version=7.5.0.Final-redhat-21
launch-type=STANDALONE                 running-mode=NORMAL
management-major-version=1             schema-locations=[]
management-micro-version=0             server-state=running
[standalone@localhost:9999 /] cd interface=
management  public      unsecure
[standalone@localhost:9999 /] cd interface=public
[standalone@localhost:9999 interface=public]

JBoss CLI supports auto-completion and command assist

[standalone@localhost:9999 interface=public] /interface=public:read-
read-attribute              read-operation-description
read-children-names         read-operation-names
read-children-resources     read-resource
read-children-types         read-resource-description
[standalone@localhost:9999 interface=public] /interface=public:read-operation-names
{
    "outcome" => "success",
    "result" => [
        "add",
        "read-attribute",
        "read-children-names",
        "read-children-resources",
        "read-children-types",
        "read-operation-description",
        "read-operation-names",
        "read-resource",
        "read-resource-description",
        "remove",
        "resolve-internet-address",
        "undefine-attribute",
        "whoami",
        "write-attribute"
    ]
}

If you need information, what an operation does

[standalone@localhost:9999 interface=public] /interface=public:read-operation-description (name="write-attribute")
{
    "outcome" => "success",
    "result" => {
        "operation-name" => "write-attribute",
        "description" => "Sets the value of an attribute for the selected resource",
        "request-properties" => {
            "name" => {
                "type" => STRING,
                "description" => "The name of the attribute to set the value for under the selected resource",
                "expressions-allowed" => false,
                "required" => true,
                "nillable" => false,
                "min-length" => 1L,
                "max-length" => 2147483647L
            },
            "value" => {
                "type" => STRING,
                "description" => "The value of the attribute to set the value for under the selected resource. May be null if the underlying model supports null values.",
                "expressions-allowed" => false,
                "required" => false,
                "nillable" => true,
                "min-length" => 1L,
                "max-length" => 2147483647L
            }
        },
        "reply-properties" => {},
        "read-only" => false
    }
}
Please remember the terms for blog comments.