jbpm实例显示图片的pic.jsp报错:getOutputStream() has already been called for this response

错误:

java.lang.IllegalStateException: getOutputStream() has already been called for this response
 at org.apache.catalina.connector.Response.getWriter(Response.java:604)
 at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:198)
 at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125)
 at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:118)
 at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:186)
 at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:118)
 at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:77)
 at org.apache.jsp.project.flowManage.pic_jsp._jspService(pic_jsp.java:88)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at com.Space_debris.filter.ChangeCharsetFilter.doFilter(ChangeCharsetFilter.java:28)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 at java.lang.Thread.run(Thread.java:619)

 

 

根据提示,找到pic_jsp.java:88 是:

finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }

这里是在释放在jsp中使用的对象,会调用response.getWriter(),因为这个方法是和

response.getOutputStream()相冲突的!所以会出现以上这个异常。

 

解决方法是:

在使用完输出流以后调用以下两行代码即可:

out.clear();

out = pageContext.pushBody();

 

 

 

 

 

解决问题参考:http://blog.163.com/first_lost/blog/static/4441142620093151212263/

你可能感兴趣的:(jsp,jbpm)