Tuesday, August 6, 2019

JBOSS CLI Offline:


There is no direct way to update a custom standalone.xml file using offline mode. Instead you can copy the custom standalone.xml file to EAP suite default standalone configuration directory and modify as below.

[jbossuser@redhat Redhat_EAP-7.1.0]$ cd bin/

[jbossuser@redhat bin]$ ./jboss-cli.sh
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.

[disconnected /]

[disconnected /] embed-server --server-config=/u01/app/redhat/config/domains/dev_domain/configuration/standalone.xml --std-out=echo
00:05:59,018 INFO  [org.jboss.modules] (AeshProcess: 2) JBoss Modules version 1.6.0.Final-redhat-1
Cannot start embedded server: WFLYEMB0022: Cannot invoke 'start' on embedded process: WFLYCTL0214: Could not get main file: /u01/app/redhat/config/domains/dev_domain/configuration/standalone.xml. Specified files must be relative to the configuration dir: /home/jbossuser/Redhat_EAP-7.1.0/standalone/configuration

[disconnected /] embed-server --server-config=standalone_customized.xml --std-out=echo
00:09:19,826 INFO  [org.jboss.modules] (AeshProcess: 3) JBoss Modules version 1.6.0.Final-redhat-1
00:09:19,858 INFO  [org.jboss.msc] (AeshProcess: 3) JBoss MSC version 1.2.7.SP1-redhat-1
00:09:20,038 INFO  [org.jboss.as] (MSC service thread 1-1) WFLYSRV0049: JBoss EAP 7.1.0.GA (WildFly Core 3.0.10.Final-redhat-1) starting
00:09:22,757 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/core-service=management/management-interface=http-interface' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
00:09:22,821 INFO  [org.wildfly.security] (Controller Boot Thread) ELY00001: WildFly Elytron version 1.1.7.Final-redhat-1
00:09:22,943 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/subsystem=undertow/server=default-server/https-listener=https' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
00:09:23,267 INFO  [org.jboss.as.patching] (MSC service thread 1-1) WFLYPAT0050: JBoss EAP cumulative patch ID is: base, one-off patches include: none
00:09:23,320 WARN  [org.jboss.as.domain.management.security] (MSC service thread 1-1) WFLYDM0111: Keystore /home/jbossuser/Redhat_EAP-7.1.0/standalone/configuration/application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
00:09:23,648 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
00:09:23,658 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: JBoss EAP 7.1.0.GA (WildFly Core 3.0.10.Final-redhat-1) started in 3826ms - Started 65 of 79 services (25 services are lazy, passive or on-demand)

[standalone@embedded /] ls -l
ATTRIBUTE                   VALUE                                TYPE
launch-type                 EMBEDDED                             STRING
management-major-version    5                                    INT
management-micro-version    0                                    INT
management-minor-version    0                                    INT
name                        redhat                               STRING
namespaces                  []                                   OBJECT
organization                undefined                            STRING
process-type                Server                               STRING
product-name                JBoss EAP                            STRING
product-version             7.1.0.GA                             STRING
profile-name                undefined                            STRING
release-codename            Kenny                                STRING
release-version             3.0.10.Final-redhat-1                STRING
running-mode                ADMIN_ONLY                           STRING
runtime-configuration-state ok                                   STRING
schema-locations            []                                   OBJECT
server-state                running                              STRING
suspend-state               RUNNING                              STRING
uuid                        0a7761ed-001c-44e2-a719-6bf131d36566 STRING

CHILD                MIN-OCCURS MAX-OCCURS
core-service         n/a        n/a
deployment           n/a        n/a
deployment-overlay   n/a        n/a
extension            n/a        n/a
interface            n/a        n/a
path                 n/a        n/a
socket-binding-group n/a        n/a
subsystem            n/a        n/a
system-property      n/a        n/a
[standalone@embedded /] ls -l
ATTRIBUTE                   VALUE                                TYPE
launch-type                 EMBEDDED                             STRING
management-major-version    5                                    INT
management-micro-version    0                                    INT
management-minor-version    0                                    INT
name                        redhat                               STRING
namespaces                  []                                   OBJECT
organization                undefined                            STRING
process-type                Server                               STRING
product-name                JBoss EAP                            STRING
product-version             7.1.0.GA                             STRING
profile-name                undefined                            STRING
release-codename            Kenny                                STRING
release-version             3.0.10.Final-redhat-1                STRING
running-mode                ADMIN_ONLY                           STRING
runtime-configuration-state ok                                   STRING
schema-locations            []                                   OBJECT
server-state                running                              STRING
suspend-state               RUNNING                              STRING
uuid                        0a7761ed-001c-44e2-a719-6bf131d36566 STRING

CHILD                MIN-OCCURS MAX-OCCURS
core-service         n/a        n/a
deployment           n/a        n/a
deployment-overlay   n/a        n/a
extension            n/a        n/a
interface            n/a        n/a
path                 n/a        n/a
socket-binding-group n/a        n/a
subsystem            n/a        n/a
system-property      n/a        n/a
[standalone@embedded /]


To view or re-direct the configuration:

$JBOSS_HOME/bin/jboss-cli.sh --controller=localhost:19990 --connect --command=":read-config-as-xml()"

same command with direct to a .xml file is as below

$JBOSS_HOME/bin/jboss-cli.sh --controller=localhost:19990 --connect --command=":read-config-as-xml()" > /tmp/my-config.xml


To restart JBoss or WildFly using command line interface (CLI):


$JBOSS_HOME/bin/jboss-cli.sh -c --command=:shutdown(restart=true)
The same command without the restart parameter will simply shutdown JBoss and WildFly:
$JBOSS_HOME/bin/jboss-cli.sh -c --command=:shutdown

To reload JBoss and WildFly configuration using JBoss CLI:
$JBOSS_HOME/bin/jboss-cli.sh -c --command=:reload

Note:

There is a difference between :reload and :shutdown(restart=true) commands.
:reload shuts down JBoss and starts it again without JVM restart.
:shutdown(restart=true) restarts whole JVM process of the JBoss server.

No comments:

Post a Comment