部署到Tomcat时,Grails 3会话超时不起作用 [英] Grails 3 session timeout not working when deployed to Tomcat

查看:175
本文介绍了部署到Tomcat时,Grails 3会话超时不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Grails 3.2.3 。我已经增加了会话超时,如 https://stackoverflow.com/a/30861747/2405040 所述,即增加 application.yml

 服务器:
会话:
超时时间:604800#一周以秒为单位

session.getMaxInactiveInterval()返回604800,但是当我在Tomcat上部署WAR(使用 Tomcat 8.5.6 )时,会话超时设置没有被反映,并且该值默认为1800秒。



org.springframework.boot:spring-boot-starter-tomcat code>在 build.gradle 中设置为提供



(我以前正在修改会话超时,因为我在这里描述了 https://stackoverflow.com/a/40382383/2405040 但后来我意识到那一点与嵌入式tomcat相关,因此切换到 application.yml 设置)



我在这里丢失了什么吗? p>

解决方案

最好的猜测是,您部署的Tomcat容器不会使用

 服务器:
会话:
超时:604800

$ b $您设置的b

值,因为这只是针对嵌入式Tomcat容器的指令。当您部署为war时,您必须配置您部署的Tomcat服务器:


I'm using Grails 3.2.3. I've increased the session timeout as described here https://stackoverflow.com/a/30861747/2405040 i.e. adding the following in application.yml:

server:
   session:
      timeout: 604800 #one week in seconds

This is working fine while in development i.e. session.getMaxInactiveInterval() returns 604800 but when I'm deploying the WAR on a Tomcat (using Tomcat 8.5.6), this session timeout setting is not reflected and the value is default to 1800 seconds.

"org.springframework.boot:spring-boot-starter-tomcat" is set to provided in build.gradle.

(I was previously modifying the session timeout as I described here https://stackoverflow.com/a/40382383/2405040 but later I realized that, that is related to embedded tomcat so switched to above application.yml setting)

Am I missing anything here?

解决方案

A best guess would be, that the Tomcat container you deploy to does not use the

server:
   session:
      timeout: 604800

value you set, as this is only a directive to the embedded Tomcat container. When you deploy as war, you have to configure the Tomcat server you deploy to:

https://tomcat.apache.org/tomcat-8.0-doc/config/http.html

这篇关于部署到Tomcat时,Grails 3会话超时不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆