There
used to be a tool called twiddle which is a command line utility for
connecting to servers and queried the MBeans on the Server. This
utility is no being replaced by More better tool called the Command
Line Interface (CLI) which is available in /bin location in JBoss
Directory.
We
can start this tool by executing the “jboss-cli.sh” script.For
this to work , we need to start the server first and then use the
command to connect.Once you execute this script , the first thing we
need to do is to connect the server running like
C:\Users\xprk477\jboss-eap-6.0\bin>jboss-cli.bat
You
are disconnected at the moment. Type 'connect' to connect to the
server or 'help' for the list of supported com
mands.
[disconnected
/] connect
[standalone@localhost:9999
/]
Once
you issue the “Connect” command , it connects to the existing
server.
Starting
from the Jboss 7 release there is security enabled by default on the
Jboss 7 distribution for remote clients. Thus management interfaces
are secured by default to prevent unauthorized remote access whilst
still allowing access for local users for an easier out of the box
experience.
If
you are connecting to a remote host controller, then you need to
provide your credentials:
./jboss-cli.sh
--connect <IP Address>
Authenticating
against security realm: <IP Address>
Username:system
Password:*****
Connected
to standalone controller at <IP Address>:9999
[standalone@192.168.1.1:9999
/]
Basic
Commands
The
Command line interface can perform a lot of use full management
related commands on the server.
Reload
| Reload the Server Configuration:Use the Reload Command to reload
the Server Configuration
[localhost:9999
/] :reload
The
new server structure
Stopping
JBoss
We
can use CTRL+C to stop a Jboss Server. We can also use Jboss CLI to
perform this like
[disconnected
/] connect
Connected
to localhost:9999
[localhost:9999
/] :shutdown
Pass
Arguments
We
can also pass arguments to the jboss-cli script for performing the
Shutdown like
jboss-cli.sh
--connect command=:shutdown # Unix / Linux
Directory
Structure
We
can also use Jboss-CLI to browse the Mbeans of the Jboss server to
get various details. This looks much like the file system directory
structure like
[standalone@localhost:9999
/] ls
core-service
deployment
extension
interface
path
socket-binding-group
subsystem
system-property
launch-type=STANDALONE
management-major-version=1
management-micro-version=0 management-minor-version=3
name=pkmi-ds057e95c
namespaces=[]
process-type=Server
product-name=EAP
product-version=6.0.1.GA
profile-name=undefined
release-codename=Arges
release-version=7.1.3.Final-redhat-4
running-mode=NORMAL
schema-locations=[]
server-state=running
we
can use the “ls” command for viewing the contents of the
current Directory Structure.
Consider
it we need to find details about the application in web Sub Sytems ,
we can use
[standalone@localhost:9999
subsystem=web] ls -l /deployment=myApp.war/subsystem=web
ATTRIBUTE
VALUE TYPE
active-sessions
0 INT
context-root
/myApp STRING
duplicated-session-ids
0 INT
expired-sessions
0 INT
max-active-sessions
0 INT
rejected-sessions
0 INT
session-avg-alive-time
0 INT
session-max-alive-time
0 INT
sessions-created
0 INT
virtual-host
default-host STRING
CHILD
MIN-OCCURS MAX-OCCURS
servlet
n/a n/a
Disable
an Application
[standalone@localhost:9999
/] /deployment=myApp.war:undeploy()
Enable
an Applications
[standalone@localhost:9999
/] /deployment=myApp .war:deploy()
Redeploy
the Applications
[standalone@localhost:9999
/] /deployment=myApp .war:redeploy
Happy learning