Hi,

JBoss AS7 provides wonderful tools for the Administrators which can be used to manage/monitor our application server and it’s resources. A Very efficient and growing WebConsole, A JAXRS enabled server management, And CLI (Command Line Utility) jboss-cli.sh

JBoss CLI command line Utility is really a wonderful management utility. But some people find it very complex to remember the syntax of CLI, So for the simplicity of the JBossAS7 users the JBoss provides a very imteresting feature if running the CLI utility in GUI mode. Here in this example we will see how we can run this jboss-cli.sh utility in GUI mode very easily to configure/edit our various resources.

You can refer to some previous articles of CLI utility where we run we run it in CLI mode only. Like: http://middlewaremagic.com/jboss/?p=419 and http://middlewaremagic.com/jboss/?p=391 But now in order to run the “jboss-as-7.1.1.Final/bin/jboss-cli.sh” utility in Graphical mode we will need to run the following command:

 

No Need to remember to CLI syntax anymore

.
.
     cd /home/userone/jboss-as-7.1.1.Final/bin

    ./jboss-cli.sh  --connect controller=10.10.10.10:9999 --gui
.
.

Notice that we are trying to start the jboss-cli.sh utility in GUI Mode with thehelp of option “–gui”. Also if you get the following exception then make sure that the JBoss Management Address or Port is correctly passed to the above command.

org.jboss.as.cli.CliInitializationException: Failed to connect to the controller
	at org.jboss.as.cli.impl.CliLauncher.initCommandContext(CliLauncher.java:229)
	at org.jboss.as.cli.impl.CliLauncher.main(CliLauncher.java:195)
	at org.jboss.as.cli.CommandLineMain.main(CommandLineMain.java:34)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.jboss.modules.Module.run(Module.java:260)
	at org.jboss.modules.Main.main(Main.java:291)
Caused by: org.jboss.as.cli.CommandLineException: The controller is not available at localhost:9999
	at org.jboss.as.cli.impl.CommandContextImpl.connectController(CommandContextImpl.java:639)
	at org.jboss.as.cli.impl.CommandContextImpl.connectController(CommandContextImpl.java:613)
	at org.jboss.as.cli.impl.CliLauncher.initCommandContext(CliLauncher.java:227)

So if you get any kind of above exception then make sure that your the Controller is accessible from thr “jboss-cli” end. Or check if you started your JBossAS as following: or not (notice the “-bmanagement” address in the following command)

.
.
       ./standalone.sh -c standalone-full.xml  -b 10.10.10.10 -bmanagement 10.10.10.10
.
.

For example Changing the attribute value of “max-save-post-size” of “http” Connectors in the “web” subsystem using CLI in GUI Mode: You will notice that the following kind of CLI command is generated. (WoW !!! we need not to worry about the Syntax anymore 🙂 )

Started JBoss CLI in GUI Mode_1

Expand the  the Connector=http Present in the “Subsystem=web” and then Right click on “max-save-post-size”

Started JBoss CLI in GUI Mode_1

Started JBoss CLI in GUI Mode_1

Change the Value of “max-save-post-size”

Started JBoss CLI in GUI Mode_1

Started JBoss CLI in GUI Mode_1

Notice that the CLI Command is generated at the Top of the GUI window… just beside the “Submit” Button. Just press the Submit button to run the CLI Command.

Started JBoss CLI in GUI Mode_1

Started JBoss CLI in GUI Mode_1

JBoss_CLI_In_GUI_Mode_5

JBoss_CLI_In_GUI_Mode_5

.
.
         /subsystem=web/connector=http/:write-attribute(name=max-save-post-size,value=8096)
.
.

NOTE:  there are many more improvements happened in the JBoss CLI utility “jboss-cli.sh” after JBoss As7.1.1.Final  release  … which are really amazing …

So Don’t forget to visit the following link:    https://community.jboss.org/wiki/UsingCLIGUIWithJconsoleOnJBossAS7 To see How JConsole will be integrated with JBoss CLI .
.
.
Thanks
Middleware Magic Team 🙂

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.