How to set a session to timeout in 2 minutes as I set maxInactiveInterval(in ROOT.xml)?
See original GitHub issueHi, I’m testing with sharing sessions using tomcat-redis-session-manager jar. Sessions are stored in Redis as I expected but session timeout is not working.
I understand that if I set maxInactiveInterval=120(ROOT.xml) then session will be expired in 2 minutes. But whether or not I configures session maxInactiveInterval, session expired in 5 minutes. It seems maxInactiveInterval doesn’t work. Did I misunderstand something?
I’m wondering if I programatically set the time limit of inactivity by
request.getSession().setMaxInactiveInterval(7* 60); //7 minutes
I think session timeout minutes this configuration has high priority but session expired in 5 minutes(web.xml configurataion).
Currently, we have our session timeout set in the Catalina/ROOT.xml file, like this
<Context path="/">
<Valve className="com.radiadesign.catalina.session.RedisSessionHandlerValve" />
<Manager className="com.radiadesign.catalina.session.RedisSessionManager"
host="x.x.x.x."
port="6380"
password="xxxx"
database="0"
maxInactiveInterval="120" />
</Context>
and myapplication/web.xml file
<session-config>
<session-timeout>5</session-timeout>
</session-config>
...
* Using
Tomcat 7 version
Java 1.7.0_65 version
tomcat-redis-session-manager-1.2-tomcat-7-java-7.jar
jedis-2.1.0.jar
commons-pool-1.6.jar
I added these jars in Tomcat/lib and reboot the server.
Thank you in advance.
Issue Analytics
- State:
- Created 9 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
SessionTimeout: web.xml vs session.maxInactiveInterval()
My container is WebLogic. Currently, we have our session timeout set in the web.xml file, like this <session-config> <session-timeout> ...
Read more >RE: Icefaces "User Session Expired" - Liferay Community
The default is 30 minutes and the setting in the web.xml of each individual portlet ... changing the session timeout in root web.xml...
Read more >Setting the session timeout in the server.xml file - IBM
In a single-server environment, log on to the server as a root user. Enter the following command to ensure that the ioc.user user...
Read more >How to configure the session timeout in servlet - Mkyong.com
The session timeout in a web application can be configurable in two ways ... the value in deployment descriptor (web.xml) is in “minute”, ......
Read more >15.2. Configure the HTTP Session Timeout
Application - defined in the application's web.xml configuration file. · Server - specified via the default-session-timeout attribute. This setting is only ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi All,
Noted the following. The session-timeout configuration in the web.xml should be used. “maxInactiveInterval” is not used any more.
WARNING: Manager.setMaxInactiveInterval() is deprecated and calls to this method are ignored. Session timeouts should be configured in web.xml or via Context.setSessionTimeout(int timeoutInMinutes)
I’ve solved this problem.
find class RedisSession,add following codes.
find RedisSessionManager,find following codes in method saveInternal.
modify like this
find sessionFromSerializedData from RedisSessionManager.do as the following codes.