How to disable session saving in geronimo / tomcat

How to disable session saving for geronimo? Is this something I have to do? - I do not use persistent sessions in my application. (This is because I get a non-serializable error in my console, but I don't want to serialize)

+4
source share
2 answers

It depends on which web container you use in Geronimo; Both Tomcat and Jetty are supported.

Tomcat

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

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

From tomcat docs for path name: Restart redirection can be disabled by setting this attribute to an empty string.

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 save sessions by default, so you have nothing to do but make sure that SessionHandler is not enabled. Remove 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> 

Information link:

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

+7
source

The tomcat solution is shown at http://www.unicon.net/node/608 and it works like a charm for us. But I do not know if this also applies to geronimo, since we do not use it.

+1
source

Source: https://habr.com/ru/post/1381882/


All Articles