This article describes how to connect to the server through the command line interface of JBoss as. Starting with version JBossAS7, a new tool called the CLI is introduced, which is located in the%jboss_home%\bin directory.
Enter the%jboss_home%\bin directory to see if the Jboss-cli.bat script file exists. Before executing this script, you need to run the JBoss server first.
To start the JBoss application server:
>%jboss_home%\bin\standalone.bat
The CLI command-line script executes as follows:
>%jboss_home%\bin\jboss-cli.bat You is disconnected at the moment. Type ' Connect ' to connect to the server or ' help ' for the list of supported commands. [Disconnected/]
Note : This tool is not included in the Jboss-as-7.0.2.final and Jboss-as-web-7.0.2.final editions after inspection. Download the latest version of Jbossas 7.1.1 contains this tool.
As seen in the Shell, the session started, and now we need to connect to the running JBoss instance. The command is as follows:
[Disconnected/] Connect 127.0.0.1:9999 [[email protected]:9999/]
As you can see, the CLI command-line tool is already connected to a standalone, running JBoss instance at the 127.0.0.1:9999 address.
Now we can use JBoss CLI tool to stop the JBoss server with the command:
[[Email protected]:9999/]: shutdown
On-Screen output:
{"Outcome" = "Success"}
Now let's restart the server using the JBoss CLI tool and run the command:
[[Email protected]:9999/]: Reload {"outcome" = "Success"}
JBOSS7 Application Server command-line tools