I am developing a project in Java in which I want the count of all active sessions in Tomcat. Based on that I want to see how much of those users are active and actually usi
You should use JMX (Java Managemnet eXtension) and query the following
jmxObjectName: Catalina:host=localhost,path=/,type=Manager
jmxAttributeName: activeSessions
You can use jconsole to access this data. To get jmx running see http://tomcat.apache.org/tomcat-6.0-doc/monitoring.html
You have lot of advantages using JMX as you get lots of other data, too. You can put it in a munin plugin and let munin monitor it and draw nice graphs to look at.