栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Cannot create a session after the response has been committed

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Cannot create a session after the response has been committed

		ServletOutputStream os = resp.getOutputStream();
		String serverCode = CheckCodeUtil.outputVerifyImage(100, 50, os, 5);

        HttpSession session = req.getSession();
        session.setAttribute("serverCode", serverCode);

不知道为什么 response响应处理之后,再次获取session会报错,先记录下来

了解到的信息为,获取session的时机,当获取session的时机在 response处理之后会抛出此异常,将获取session的代码提取到response之前即可

java.lang.IllegalStateException: Cannot create a session after the response has been committed
	at org.apache.catalina.connector.Request.doGetSession(Request.java:2921)
	at org.apache.catalina.connector.Request.getSession(Request.java:2318)
	```
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/490314.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号