Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to turn off session persistence in geronimo/tomcat

How can I turn off session persistence for geronimo? Is this something I should be doing? - I have no use for persisted sessions in my application. (This is because I recieve a not serializable error in my console, but I do not wish to serialize)

like image 366
Mark W Avatar asked Feb 22 '23 09:02

Mark W


2 Answers

It depends upon which web container you're using within Geronimo; both Tomcat and Jetty are supported.

Tomcat
Add a context.xml file to your application or add these nodes:

<Context><Manager className="org.apache.catalina.session.StandardManager"
  pathname=""></Manager></Context>

From the tomcat docs for pathname: Restart persistence may be disabled by setting this attribute to an empty string.

The properties are explained at these links:
https://cwiki.apache.org/GMOxDOC22/configuring-session-manager-of-tomcat.html
http://tomcat.apache.org/tomcat-6.0-doc/config/manager.html#Standard_Implementation

Jetty
This container does not persist sessions by default, so there there is nothing to do except to make sure that the SessionHandler is not enabled. Remove the sessionHandler node if it exists in your context configuration.

<Set name="sessionHandler">
<New class="org.eclipse.jetty.servlet.SessionHandler">
  <Arg>
    <New class="org.eclipse.jetty.servlet.HashSessionManager">
      <Set name="storeDirectory">your/chosen/directory/goes/here</Set>
    </New>
  </Arg>
</New></Set>

Informational link:
http://wiki.eclipse.org/Jetty/Howto/Persisting_Sessions

like image 177
Paul Gregoire Avatar answered Feb 24 '23 23:02

Paul Gregoire


The solution for tomcat is depicted in http://www.unicon.net/node/608 and it works like a charm for us. But I don't know if this also applies to geronimo since we are not using it.

like image 35
Gandalf Avatar answered Feb 24 '23 22:02

Gandalf