We used to query the active session count by using the following code up to JBoss 7:
ObjectName name = new ObjectName(jboss.web:type=Manager,path=/MyWebApp,host=default-host);
MBeanServer jboss = MBeanServerLocator.locateJBoss();
this.sessions = new Long((Integer) jboss.getAttribute(name, "activeSessions"));
That no longer works with JBoss Wildfly. I can't really find the proper documentation to access the same information with the current version of JBoss AS.
I've come across some links like http://blog.akquinet.de/2014/09/15/monitoring-the-jboss-eap-wildfly-application-server-with-the-command-line-interface-cli/ which imply a totally different location of that information – but I can't figure out how to access it via Java code.
/deployment=example.ear/subdeployment=example-web.war/subsystem=under
The old reference to -Dorg.apache.tomcat.util.ENABLE_MODELER=true
from JBoss 7 didn't help either. My older question via MBean "jboss.web:type=Manager,path=/,host=localhost" not found doesn't work anymore.