java.io.IOException: Error: JSP Buffer overflow
- 错误
jsp页面报错如下:
1 Stacktrace: 2 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466) 3 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) 4 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) 5 javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 6 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 7 org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238) 8 org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250) 9 org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047) 10 org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817) 11 org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) 12 org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) 13 org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560) 14 javax.servlet.http.HttpServlet.service(HttpServlet.java:648) 15 javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 16 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 17 com.tera.sys.filter.AccessFilter.doFilter(AccessFilter.java:80) 18 org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) 19 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 20 org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) 21 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 22 23 root cause 24 25 java.io.IOException: Error: JSP Buffer overflow 26 org.apache.jasper.runtime.JspWriterImpl.bufferOverflow(JspWriterImpl.java:158) 27 org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:328) 28 java.io.Writer.write(Writer.java:157) 29 org.apache.jsp.WEB_002dINF.jsp.erule.manage.rulelHis.compareRule_jsp._jspx_meth_c_005fif_005f5(compareRule_jsp.java:428) 30 org.apache.jsp.WEB_002dINF.jsp.erule.manage.rulelHis.compareRule_jsp._jspService(compareRule_jsp.java:195) 31 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) 32 javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 33 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438) 34 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) 35 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) 36 javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 37 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 38 org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238) 39 org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250) 40 org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047) 41 org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817) 42 org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) 43 org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) 44 org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560) 45 javax.servlet.http.HttpServlet.service(HttpServlet.java:648) 46 javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 47 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 48 com.tera.sys.filter.AccessFilter.doFilter(AccessFilter.java:80) 49 org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) 50 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 51 org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) 52 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 53 54 note
- 分析
jsp页面报错,后台往前台输出的数据量小的时候不报错,数据量大的时候报错。这时突然想起来有一为了处理缓存问题,在jsp页面加了设置(最后缓存问题通过其他方式解决了,这个属性也没删,就留了下来)如下图。
- 解决办法
- 是去掉该属性
- 也可以增加新属性(buffer=”300kb”)设置缓存大小(不推荐,后台数据是动态的,不能确定大小)
<%@ page contentType=”text/html;charset=UTF-8″ autoFlush=”false” buffer=”300kb”%>
- 总结
autoFlush属性用来指定缓冲区是否自动进行强制输出。如果设置为true,那么当缓冲区满的时候仍然能够输出正常;如果设置为false,那么当缓冲区满的时候,将会产生异常。默认为true。
ps:本文为博主原创,转载请注明出处:http://www.cnblogs.com/Y-zhiwei/。