问题描述
tomcat出现这个错误,倒置服务器挂掉,错误代码如下:2009-10-280:42:30org.apache.jasper.runtime.JspFactoryImplinternalGetPageContext严重:Exceptioninitializingpagecontextjava.lang.IllegalStateException:Cannotcreateasessionaftertheresponsehasbeencommittedatorg.apache.catalina.connector.Request.doGetSession(Request.java:2301)atorg.apache.catalina.connector.Request.getSession(Request.java:2075)atorg.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833)atjavax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:216)atorg.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:545)atorg.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:494)atorg.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:144)atorg.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:122)atorg.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:107)atorg.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:63)atorg.apache.jsp.WEB_002dINF.jsp.help.front.second_jsp._jspService(second_jsp.java:57)atorg.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:803)atorg.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)atorg.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)atorg.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:803)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)atorg.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)atorg.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:535)atorg.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:472)atorg.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:134)atorg.springframework.web.servlet.view.AbstractView.render(AbstractView.java:243)atorg.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1141)atorg.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:878)atorg.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)atorg.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:461)atorg.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:416)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:690)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:803)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)atorg.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)atorg.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)atorg.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)atorg.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)atorg.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)atcom.lbfw.cct.filter.LoginFilter.doFilter(LoginFilter.java:60)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)atorg.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)atorg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)atorg.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)atorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)atorg.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)atorg.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)atorg.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)atorg.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)atorg.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)atorg.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)atjava.lang.Thread.run(Thread.java:619)
解决方案
解决方案二:
1.讲layout中的include有session判断的页面去掉2.采用Template方式,把include中有session判断的页面加入,并且在具体的gsp中直接<g:rendertemplate="userInfoTemplate"/>