How to Access JBossWeb mbeans and their Related statistics in JBoss EAP 6 ?
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
Issue
- How can we access the statistics of
"jboss.web:type=Manager"or"jboss.web:type=TreadPool,name=ajp-127.0.0.1-8009"or other JBossWeb mbeans in JBoss EAP6? - We want to basically access the runtime values of
"activeSessions","maxActiveSessions","sessionIdLength","currentThreadsBusy","currentThreadCount", etc kind of attributes which are defined in the above MBeans. - How to Monitor Http-threads using JMX?
- How to monitor webcontener threads pool on JBoss EAP 6?
- How to find
"currentThreadsBusy"and"currentThreadCount"MBean attributes in JBoss EAP6 ?
Resolution
You need to set the system property org.apache.tomcat.util.ENABLE_MODELER to true to monitor these MBeans. This system property will cause JBoss to expose the MBeans "jboss.web:type=*".
This can either be done via system property on *.conf file (standalone.conf | domain.conf) or *.xml file (standalone.xml | domain.xml), see below:
-
You can add the system property to
$JBOSS_HOME/bin/standalone.confon EAP 6 standalone mode like:JAVA_OPTS="$JAVA_OPTS -Dorg.apache.tomcat.util.ENABLE_MODELER=true" -
Or the system property can also be defined in your JBoss EAP 6 configuration files (
standalone(-*).xmlordomain.xml, etc) like:<system-properties> <property name="org.apache.tomcat.util.ENABLE_MODELER" value="true"/> </system-properties>This can be done via CLI , ie. one can add a system property via management CLI:
/system-property=org.apache.tomcat.util.ENABLE_MODELER:add(value=true)
JBoss EAP 6.0.0
Note that setting the system property ENABLE_MODELER is broken on EAP 6.0.0 as discussed in JBoss fails to start with ENABLE_MODELER set to true. The fix for the issue is included in EAP 6.0.1 onward and this This content is not included.one off patch is available on customer portal for EAP 6.0.0.
Accessing MBean via JMX client:
- See the following articles on accessing these MBean via JConsole or other JMX clients:
Examples:
Example for session info: jboss.web:type=Manager,path=/TestWebApp,host=default-host
Example for thread pool info: jboss.web:name=http--127.0.0.1-8080,type=ThreadPool
Here Test WebApp is the context root of your WAR. Once the above mentioned JAVA_OPTS / System property is enabled then evev using $JBOSS_HOME/bin/jconsole.sh script when you will try to see the MBeans you will be able to see the "jboss.web:type=Manager" as well there.
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.