Sometimes you want to check if a session is alive or already dead. There’s several ways how you can do it, but I want to tell about the one I found which looks rather simple – it’s by exposing catalina properties and operations via MBeans. It will still need some configuration, though.
First of all, you need to configure your tomcat instance for remote JMX access. If you have a script or a file setting environment variables for your deployment, you can add it to that script. Or, you can do it just by hacking the catalina.sh or startup.sh like this (see below).
export JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
This will allow us to connect to servername:9090 with jconsole when the application is up. After that, you navigate to Catalina/Manager path on the MBeans tab, find your app root, expand it and locate the list of operations:
It might not be very pretty, but you can copy-paste it to your fav editor and proceed as needed. This is it!