java.lang.IllegalStateException异常getOutputStream() has already been called for this responseat org.apache.catalina.connector.Response.getWriter(Response.java:603)at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:196)at

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 00:52:50

java.lang.IllegalStateException异常getOutputStream() has already been called for this responseat org.apache.catalina.connector.Response.getWriter(Response.java:603)at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:196)at
java.lang.IllegalStateException异常
getOutputStream() has already been called for this response
at org.apache.catalina.connector.Response.getWriter(Response.java:603)
at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:196)
at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:124)
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:117)
at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:190)
at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:118)
at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:78)
at org.apache.jsp.image_jsp._jspService(image_jsp.java:117)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:389)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:319)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:270)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:191)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:227)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:211)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:817)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:623)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:444)
at java.lang.Thread.run(Thread.java:619)
貌似是哪个流没有关闭...

java.lang.IllegalStateException异常getOutputStream() has already been called for this responseat org.apache.catalina.connector.Response.getWriter(Response.java:603)at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:196)at
我过去遇到这个问题是因为多次调用一个已经关闭的对象.
比如:同一个页面中再次调用response.sendRedirect()方法.还有可能是提交的URL错误,即不是个有效的URL.
我建议你看看是不是把response.sendRedirect()放到循环里了,或者是多次调用了.API上说调用sendRedirect()方法后,response就已经是close的了.
大哥,结贴啊.