We are running Tomcat 7.0.26 (no httpd front end) with BIO/NIO and SSL (entire webapp is in security context) and see this exception periodically on our Linux server:

May 2, 2012 3:03:45 AM org.apache.jasper.runtime.JspFactoryImpl internalGetPageContext
SEVERE: Exception initializing page context
java.lang.IllegalStateException: Cannot create a session after the response has been committed at org.apache.catalina.connector.Request.doGetSession(Request.java:2855) at org.apache.catalina.connector.Request.getSession(Request.java:2306) at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:897) at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:909) at org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:146) at org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:125) at org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:112) at org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:65) *at org.apache.jsp.playerRegistration2_jsp._jspService(playerRegistration2_jsp.java:72)* at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
*at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)*
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
*at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)*
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1600) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)

That line of code in our JSP's .java file show it to be method _jspService's second statement:

      pageContext = _jspxFactory.getPageContext(this, request, response,
                        null, true, 8192, true);

What might cause this? Curious as to why the 'service' method of HttpServlet line 722 is called twice in the call stack. How could any response have been sent out and committed when this seems to be before my JSP's main body of code is even executed? After that line of code, about 7 statements down is the code that emits the first HTML line from our JSP:

out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\";>\r\n");

And right after that is where my page bean class is instantiated or retrieved:

bean = (org.example.PlayerRegistration2Page) _jspx_page_context.getAttribute("bean", javax.servlet.jsp.PageContext.REQUEST_SCOPE);
      if (bean == null){
        bean = new org.example.PlayerRegistration2Page();
_jspx_page_context.setAttribute("bean", bean, javax.servlet.jsp.PageContext.REQUEST_SCOPE);
      }

My actual JSP source file top lines looks normal:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd";> <%@page contentType="text/html; charset=ISO-8859-1" import="org.example.PlayerRegistration2Page"%> <jsp:useBean id="bean" scope="request" class="org.example.PlayerRegistration2Page" />

So this is Tomcat throwing an exception before it even reaches my code. What might be the cause since of course the webapp works fine most of the time.

Thanks,
David

Reply via email to