Connecting To JBoss EAP Via JConsole in Domain Mode
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7.x
- 6.x
Issue
- How do I connect to a JBoss instance within a domain via JConsole?
- JConsole can not jmx connection domain mode
- We saw the following instructions for jconsole, but this is for standalone mode. What about domain mode?
- How to connect the
JBoss EAP 6
via JConsole in domain mode on Windows ? - Can not see some
mbeans
throughJConsole
after enabling therbac access-control
inEAP 6.3
. - How to connect the JBoss using jconsole in domain mode on Linux?
- How does one access the JMX info for a managed server instance in domain mode?
Resolution
To connect to JBoss EAP From JConsole:
-
Make sure
$JAVA_HOME
is set correctly -
Set the
remoting-connector
in the jmx subsystem to not use the management endpoint. In domain mode only the host controller has a management port, i.e. the instances do not have a management endpoint. Settinguse-management-endpoint=false
makes the connection use theremote endpoint
instead and it is valid for connecting with the individual servers.
Example using thefull-ha
profile:/profile=full-ha/subsystem=jmx/remoting-connector=jmx:add(use-management-endpoint=false)
This will result in a configuration change in the
domain.xml
as in:<subsystem xmlns="urn:jboss:domain:jmx:1.2"> <expose-resolved-model/> <expose-expression-model/> <remoting-connector use-management-endpoint="false"/> </subsystem>
-
Define an ApplicationRealm user with the help of
add-user.sh
oradd-user.bat
(i.e. option b when runningadd-user.sh
). If your environment contains remote host controllers, the ApplicationRealm user would be defined on each of the host controllers. -
Start
$JBOSS_HOME/bin/jconsole.sh
and connect to the instance within the domain usingservice:jmx:remoting-jmx://{$HOSTNAME}:4447
and authenticating using the previously definedApplicationRealm
user.
NOTE: JBoss EAP 7 has consolidated a lot of ports, so for JBoss EAP 7 the port associated with the HTTP socket binding (8080) should be used. In EAP 6 the protocol was remoting-jmx. In EAP 7 the protocol has been changed to remote+http.
Example
On domain configuration, set remoting connector on the domain:jmx subsystem:
<subsystem xmlns="urn:jboss:domain:jmx:1.3">
<expose-resolved-model/>
<expose-expression-model/>
<remoting-connector use-management-endpoint="false"/>
</subsystem>
Then the remoting subsystem defines the remoting connector - here the native-remoting-connector defined:
<subsystem xmlns="urn:jboss:domain:remoting:4.0">
<connector name="native-remoting-connector" socket-binding="remoting"/>
<http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/>
</subsystem>
Finally the respective socket binding:
<socket-binding-group name="full-ha-sockets" default-interface="public">
<socket-binding name="remoting" port="4447" fixed-port="true"/>
Since here there is the remoting port set to 4447, therefore the URL would look like service:jmx:remote://<hostname>:<4447>
. See notes below.
Notes :
$HOSTNAME
will be IP address or hostname on which server is running and4447
is the default remoting port. Add respective port offset in4447
to connect through jconsole.- In EAP 6.3 ,if you have enabled the
rbac access-control
then you can not see all thembeans
throgh JConsole. To see all thembeans
through JConsole , you need to add thatapplication user
withsuperuser
role throughadmin console
and set realm toApplicationRealm
while adding it. The items you can see are accessible to all. The items you cannot see are protected. On top of that, most functionality of the visible items is refused with "Not authorized" when the user is not setup in a proper role. - For JConsole connection with
https
, some additional steps are required.
Root Cause
As per jboss-as-jmx_1_2.xsd
, it seems show-model is no longer available in EAP 6.1.x
.
service:jmx:remoting-jmx://{host_name}:9999
cannot be used when attempting to connect to a specific instance within a domain. The aformentioned address connects to the domain controller. Port 9999 will be directed to the host controller, not to each managed server, using mgmt-users.properties
for authentication.
Expected ports
The table below explains the port usage vs url:
Flag | Definition | Port | URL |
---|---|---|---|
Use-management-endpoint=true (default) | port="${jboss.management.http.port:9990}" | Management Port | service:jmx:remote+http://127.0.0.1:9990 |
Use-management-endpoint=false | HTTP | port="${jboss.http.port:8080}" | service:jmx:remote+http://127.0.0.1:8080 |
Diagnostic Steps
To check if the connection request is raised on the JBoss, enable the TRACE
log for org.jboss.remoting
and check the connection information, like authentication or protocol issues.
<logger category="org.jboss.remoting">
<level name="TRACE"/>
</logger>
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
2 Comments
Good reference ==> http://planet.jboss.org/post/jmx_connections_to_jboss_as
EAP7 has consolidated a lot of ports, so for EAP7 the port associated with the HTTP socket binding (8080) should be used. EAP6 lists a remoting port in the socket bindings. EAP7 does not, so it's not clear whether it's possible to put JMX on another port.