现象:

当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。

CAS-ERR Cannot create a session after the response has been committed的更多相关文章

  1. grails中报Cannot create a session after the response has been committed异常的解决办法

    在grails中,我们在layouts\main.gsp中使用类似如下的代码来判断当前用户处于登录状态时显示相关的登录信息: <g:if test="${session.users}& ...

  2. Cannot create a session after the response has been committed

    有时候在操作Session时,系统会抛出如下异常 java.lang.IllegalStateException: Cannot create a session after the response ...

  3. [Exceptions Spring 2] - Cannot create a session after the response has been committed

    2016-02-23 14:06:27,416 [http-bio-8080-exec-1] DEBUG [org.springframework.beans.factory.support.Defa ...

  4. idea调试SpringMvc, 出现:”javax.servlet.ServletException: java.lang.IllegalStateException: Cannot create a session after the response has been committed"错误的解决方法

    调试拦截器出现以下错误: HTTP Status 500 - javax.servlet.ServletException: java.lang.IllegalStateException: Cann ...

  5. 关于springmvc重定向后Cannot create a session after the response has been committed问题

    首先先上代码吧,我在用springmvc进行response.sendRedirect(url);操作后报了Cannot create a session after the response has ...

  6. AX2012 R3 Data upgrade checklist sync database step, failed to create a session;

    最近在做AX2012 R3 CU9 到CU11的upgrade时 (用的Admin帐号), 在Date upgrade 的 synchronize database 这步 跑了一半,报出错误 说“fa ...

  7. 报警告session_regenerate_id(): Failed to create(read) session ID: files (path: N;/path)

    php.ini文件中的session.save_path = "N;/path"注释掉(前面加分号)

  8. (day20)javaEE三大组件之一Servlet (简介(二)servletconfig,servletContext,session,cookie,request,response,out)

    javaEE是服务器编程,javaEE提供了服务器的接口让具体的服务器去创建实现的对象 JavaEE是sun公司为了解决企业级开发定义的一套技术,只提供了规范,具体的实现是由服务器完成的 servle ...

  9. spring security之httpSecurity使用示例

    如果在HttpSecurity中配置需要authenticate(),则如果没有登陆,或没有相关权限,则会无法访问 2017-01-02 23:39:32.027 DEBUG 10396 --- [n ...

随机推荐

  1. Linux下实时查看GPU状况

    1. 显示当前GPU使用情况 Nvidia自带了一个nvidia-smi的命令行工具,会显示显存使用情况: $ nvidia-smi 输出如下: 2. 周期性输出GPU使用情况 但是有时我们希望不仅知 ...

  2. crm 系统项目(三) 业务

    1. 项目背景 crm系统是某教育平台正在使用的项目,系统主要为 销售部.运营部.教质部门提供管理平台,随着公司规模的扩展,对公司员工的业务信息量化以及信息化建设越来越重要. crm系统为不同角色的用 ...

  3. [luogu] P4823 [TJOI2013]拯救小矮人(贪心)

    P4823 [TJOI2013]拯救小矮人 题目描述 一群小矮人掉进了一个很深的陷阱里,由于太矮爬不上来,于是他们决定搭一个人梯.即:一个小矮人站在另一小矮人的 肩膀上,知道最顶端的小矮人伸直胳膊可以 ...

  4. slot插槽(学习笔记)

    slot插槽(有默认值,也有名称)一般情况下通过名称进行匹配什么是插槽,有什么用?插槽相当于插入的一个东西,可以用来灵活的封装组件,比如说封装一个模态框对组件进行内容的定制,slot插槽,一对组件标签 ...

  5. C/s模式与B/S模式

    C/S模式事是client/server,即客服端/服务模式

  6. 洛谷 P1461 海明码 Hamming Codes

    P1461 海明码 Hamming Codes 题目描述 给出 N,B 和 D,要求找出 N 个由0或1组成的编码(1 <= N <= 64),每个编码有 B 位(1 <= B &l ...

  7. 打印全排列和stl::next_permutation

    打印全排列是个有点挑战的编程问题.STL提供了stl::next_permutation完美的攻克了这个问题. 可是,假设不看stl::next_permutation,尝试自己解决,怎么做? 非常自 ...

  8. Sambaserver搭建

    1. 安装Samba及相关包 $ sudo apt-getinstall samba samba-common smbfspython-glade2system-config-samba 2. 创建共 ...

  9. [jzoj 4879] [NOIP2016提高A组集训第11场11.9] 少女觉 解题报告 (贪心)

    题目链接: http://172.16.0.132/senior/#main/show/4879 题目: 在幽暗的地灵殿中,居住着一位少女,名为古明地觉.据说,从来没有人敢踏入过那座地灵殿,因为人们恐 ...

  10. hihocoder 1407 重复旋律2

    思路: 二分一哈答案 height分个块 //By SiriusRen #include <cstdio> #include <cstring> #include <al ...