ITeye博客

Session IllegalStateException

water84222 · 2010-06-15 14:56 · web开发 · 企业架构 · Markdown

request.getSession();

出现IllegalStateException 异常。

查看tomcat 源码

if ((context != null) && (response != null) &&
            context.getCookies() &&
            response.getResponse().isCommitted()) {
            throw new IllegalStateException
              (sm.getString("coyoteRequest.sessionCreateCommitted"));
        }

 出现这个异常的原因就是这几种,对于response.getResponse().isCommitted(),就是说当response 提交返回了,
就无法设置cookie,如果创建session前,response 已经提交了,那么这个新的session就无法与cookie保持一致了。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。