现象:

当cas 登录人数较少时候没有错误,但是用户过多时候出现下列err
May-2016 18:09:11.932 SEVERE [http-nio-8080-exec-52] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [cas] in context with path [/dlcas-server] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: Cannot create a session after the response has been committed] with root cause
java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.apache.catalina.connector.Request.doGetSession(Request.java:2935)
at org.apache.catalina.connector.Request.getSession(Request.java:2305)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:895)
at org.springframework.webflow.context.servlet.HttpSessionMap.getMutex(HttpSessionMap.java:98)
at org.springframework.webflow.core.collection.LocalSharedAttributeMap.getMutex(LocalSharedAttributeMap.java:39)
at org.springframework.webflow.conversation.impl.ContainedConversation.unlock(ContainedConversation.java:108)
at org.springframework.webflow.execution.repository.support.ConversationBackedFlowExecutionLock.unlock(ConversationBackedFlowExecutionLock.java:55)
at
…………

解决方法:

cas-servlet.xml 配置文件



<bean id="terminateWebSessionListener" class="org.jasig.cas.web.flow.TerminateWebSessionListener"

p:timeToDieInSeconds="这边调大点,默认是2" />

原理

参考 http://www.mytju.com/classcode/news_readNews.asp?newsID=504

发现重新设置了SessionID,正常登录时则不会设置。

怀疑是Session不存在了,导致后台重新创建Session,重新返回了login页面。

找到org.jasig.cas.web.flow下的TerminateWebSessionListener.java,

这个类监听sessionStarted和sessionEnded事件,

加log后执行,

发现,访问login页面时是session start,登录成功后是session end,

也就是说,登录动作执行后这个session就被咔嚓掉了~~~

喀嚓掉,是使用

webSession.setMaxInactiveInterval(this.timeToDieInSeconds);实现的。

默认值是2,也就是两秒

private int timeToDieInSeconds = 2;

执行logout时,只是让TGC无效,并没有重新创建Session。

最新文章

  1. mysql的缓冲查询和非缓冲查询
  2. HTML5在VS2010中的智能提示
  3. mybatis进阶
  4. button与submit
  5. UVALive 3415 Guardian of Decency(二分图的最大独立集)
  6. (转)Java关键字final、static使用总结
  7. ASP.NET MVC- Model- An Introduction to Entity Framework for Absolute Beginners
  8. Android五个布局
  9. 合并多段zip文件并解压缩
  10. 百叶窗特效(用move.js库)
  11. experss框架—基础认识
  12. 树莓派3 之 启动显示和wifi相关参数设置
  13. 《DSP using MATLAB》Problem 7.15
  14. string.GetHashCode获取值不一样
  15. git &amp; github 同步文件
  16. WebService的一种简单应用方式入门
  17. 【AtCoder】AGC024
  18. 听听各位对Ubuntu的UI的看法
  19. Python 字典 in 操作符
  20. Sublime Text 3 插件的安装、升级和卸载

热门文章

  1. [USACO18FEB] Snow Boots G (离线+并查集)
  2. Android开发进度07
  3. 通过rpm安装jdk
  4. SpringBoot 消费NSQ消息
  5. 【codeforces 812A】Sagheer and Crossroads
  6. echarts 设置x轴的和y轴的属性
  7. 玩转oracle学习第六天
  8. JQuery与CSS之图片上放置button
  9. Hive分区表与分桶
  10. SQL语句将某字段查询出以逗号隔开