Default Session Persistence for a Web Application (explained..)
By default Tomcat (5.x onwards, based on my knowledge) persists all the user session (HttpSession) objects. Tomcat maintains these session objects for individual web apps under it's work
directory. So if your web application context is myapp
, Tomcat persists the session objects in a file named SESSIONS.ser
under directory %Tomcat_Home%/work/Catalina/localhost/myapp
. The session persistence works across Tomcat or web application restarts.
Disabling Session Persistence
This session persistence of-course may not be a needed feature for all types of web applications. So someone may want to just disable the session persistence. To do this, Open file %Tomcat_Home%/conf/context.xml
This file by default has standard manager implementation configured, which implements the session persistence across Tomcat or web-app restarts. To disable the session persistence, uncomment the line <Manager pathname="" />
Here is official Tomcat documentation reference link for this - http://tomcat.apache.org/tomcat-6.0-doc/config/manager.html#Disable_Session_Persistence
remove it use shell
my $SESSION_CACHE_FILE = "$CATALINA_BASE/work/Catalina/localhost/_/SESSIONS.ser";
if ( -e $SESSION_CACHE_FILE ) {
unlink $SESSION_CACHE_FILE;
}