现象:

当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下pyftplib简单的脚本

    from pyftpdlib.authorizers import DummyAuthorizer from pyftpdlib.handlers import FTPHandler from pyf ...

  2. 使用uglifyjs压缩JS

    一般vue项目完成打包以后需要优化,特别是首次打开加载速度们,webpack打包以后js文件体积很大等方法,可以用这个方法来压缩js文件 安装node.js 安装当前应用 -- uglifyjs 如何 ...

  3. Vue入门教程(2)

    小白入门学习vue和vue实例,vue总结 这就是我脑海中的 Vue 知识体系: 一句话概况了 Vue 通过尽可能简单的 API 实现响应的数据绑定和组合的视图组件 Vue 的创建 我们的学习目的肯定 ...

  4. 数据库之Case When

    近期几天的工作本来组长是安排我用mindfocion画几个图,本来以为难点是这个控件的使用,可是开发的时候才发现由于数据量有点多,所以在开发的时候汇总这些信息倒是费了我许多的功夫,最后总结一下就是写了 ...

  5. cmd文件操作-添加

    新建文件夹 mkdir 文件名 mkdir wenjianjia 新建文件 type NUL > 文件名.文件类型

  6. virtio netdev的创建

    Linux眼下支持至少了8种虚拟化系统: Xen KVM VMware's VMI IBM's System p IBM's System z User Mode Linux lguest IBM's ...

  7. Android圆形图片--自己定义控件

    Android圆形图片控件效果图例如以下: 代码例如以下: RoundImageView.java package com.dxd.roundimageview; import android.con ...

  8. iOS7实现带文本输入框的UIAlertView及获取TextField文本内容

    if (customAlertView==nil) { customAlertView = [[UIAlertView alloc] initWithTitle:@"自定义服务器地址&quo ...

  9. TSNE——目前最好的降维方法

    转自:http://blog.csdn.net/u012162613/article/details/45920827 1.流形学习的概念 流形学习方法(Manifold Learning),简称流形 ...

  10. linux 下的文件搜索、可执行文件搜索

    1. whereis 与 which 速度快,只是模糊查询,例如查询 $ whereis mysql,则会将mysql, mysql.ini, mysql*所在的目录都找出来: whereis 查看的 ...