Friday, April 20, 2018

jboss-cli

https://docs.jboss.org/author/display/WFLY/Command+Line+Interface

$ ./jboss-cli.sh



Unable to read the logging configuration from 'file:/d/apps/wildfly12/bin/jboss-cli-logging.properties' (java.io.FileNotFoundException: \d\apps\wildfly12\bin\jboss-cli-logging.properties (The system cannot find the path specified))
INFO  [org.jboss.modules] JBoss Modules version 1.7.0.Final
INFO  [org.jboss.as.cli.CommandContext] You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect
connect
INFO  [org.xnio] XNIO version 3.6.2.Final
INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.6.2.Final
INFO  [org.jboss.remoting] JBoss Remoting version 5.0.5.Final
INFO  [org.jboss.threads] JBoss Threads version 2.3.1.Final
INFO  [org.wildfly.security] ELY00001: WildFly Elytron version 1.2.2.Final
ERROR [org.jboss.as.cli.CommandContext] The controller is not available at localhost:9990: java.net.ConnectException: WFLYPRT0053: Could not connect to remote+http://localhost:9990. The connection failed: WFLYPRT0053: Could not connect to remote+http://localhost:9990. The connection failed: Connection refused: no further information
The controller is not available at localhost:9990: java.net.ConnectException: WFLYPRT0053: Could not connect to remote+http://localhost:9990. The connection failed: WFLYPRT0053: Could not connect to remote+http://localhost:9990. The connection failed: Connection refused: no further information



Instead of the normal ports 8080/9990 I have 8180/10090 , because in standalone.xml I have specified in socket-binding-group a jboss.socket.binding.port-offset:100

So I try with

./jboss-cli.sh --controller=localhost:10090

and I get a beautiful

INFO  [org.xnio] XNIO version 3.6.2.Final
INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.6.2.Final
INFO  [org.jboss.remoting] JBoss Remoting version 5.0.5.Final
INFO  [org.jboss.threads] JBoss Threads version 2.3.1.Final
INFO  [org.wildfly.security] ELY00001: WildFly Elytron version 1.2.2.Final
[standalone@localhost:10090 /]



If you look in jboss-cli.xml you see that the default controller is configured in it:

<!-- The default controller to connect to when 'connect' command is executed w/o arguments -->
    <default-controller>
        <protocol>remote+http</protocol>
        <host>localhost</host>
        <port>9990</port>
    </default-controller>

If I change 9990 to 10090, I can seamlessly connect without having to specify the --controller=localhost:10090

Remarkable also the .jbossclirc file. "# WildFly (JBoss) CLI will execute commands from this file before
# the command line session (interactive or not) will start."


Regarding the message "Unable to read the logging configuration from 'file:/d/apps/wildfly12/bin/jboss-cli-logging.properties' ", I have it only when running the jboss-cli.sh in git bash.... if I run jboss-cli.bat I don't have the problem. Most likely it's due to the fact that in git bash the $JBOSS_HOME is rendered as file:/d/apps/wildfly12/ , and Java can't handle this... welcome to the messy world of Windows...


It seems also that the TAB autocomplete is not working under git bash.... I am switching permanently to a DOS console.... how sad..



Useful CLI:

#dump elytron configuration
/subsystem=elytron:read-resource(recursive=true)

#dump logger configuration
/subsystem=logging/console-handler=CONSOLE:read-resource

#add a filesystem-realm and add a user
#see https://docs.jboss.org/author/display/WFLY/WildFly+Elytron+Security#WildFlyElytronSecurity-ConfigureAuthenticationwithaFilesystemBasedIdentityStore

/subsystem=elytron/filesystem-realm=exampleFsRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir)
/subsystem=elytron/filesystem-realm=exampleFsRealm/:add-identity(identity=user1)
cd subsystem=elytron
cd filesystem-realm=exampleFsRealm
:set-password(identity=user1,clear={password="password123"})

#(this creates a file user1-OVZWK4RR.xml with inside 'identity xmlns="urn:elytron:1.0"' )




PRICELESS: ./jboss-cli.sh --gui opens a UI which really simplifies the discovery of CLI syntax

PRICELESS: https://wildscribe.github.io/WildFly/12.0/index.html Wildfly Reference model, all attributes and operations explained (very briefly, but better than nothing)







No comments: