Jan Luehe's Blog
How to Disable Persisting of Memory-based HTTP Sessions during a Server Restart
How to Disable Persisting of Memory-based HTTP Sessions during a Server Restart
When stopping your Glassfish server, all memory-based HTTP sessions created by web applications deployed on your server are persisted into files using serialization, and restored from their serialized format during a subsequent restart of the server, after which the files containing the serialized sessions are deleted.Only those sessions that are still valid (i.e., have not yet expired) at the time the server is stopped are subject to being persisted.
The HTTP sessions are persisted for each web application individually, in this file:
${GF_HOME}/domains/domain1/generated/jsp/j2ee-modules/<module_name>/<context_path>_SESSIONS.ser
where ${GF_HOME} points to your Glassfish installation directory, <module_name> is the name of your web application, and <context_path> is the context path at which your web application has been deployed.
If your web application is bundled inside an EAR file, its sessions will be persisted in this file:
${GF_HOME}/domains/domain1/generated/jsp/j2ee-apps/<app_name>/<module_name>/<context_path>_SESSIONS.ser
where <app_name> is the name of your EAR-packaged application.
Many folks have wondered if it was possible to disable session persistence for their webapps, and the good news is: Yes, Glassfish makes this possible! All you need to do is specify a sessionFilename property with an empty value in your web application's sun-web.xml resource (located inside your web application's /WEB-INF directory), like this:
<sun-web-app>
<session-config>
<session-manager>
<manager-properties>
<property name="sessionFilename" value="" />
</manager-properties>
</session-manager>
</session-config>
</sun-web-app>
The sessionFilename property may be used to customize the name of the file where persisted sessions are stored for your web application, and an empty value has the special semantics of disabling the persisting of memory-based sessions for your web application during a server restart.
Posted at 01:28PM Feb 16, 2006 by Jan Luehe in Sun | Comments[1]
Is there a container-wide configuration option for this, so you don't have to edit the sun-web.xml of every webapp?
Posted by keccs on June 16, 2009 at 04:52 AM PDT #