将web程序从tomcat移到weblogic中验证码无法显示:
查看日志发现报错:
<> <> <1389665691275> <BEA-101019> <[ServletContext@17320663[app:dbCenter-web module:dbCenter-web.war path:/dbCenter-web spec-version:2.5]] Servlet failed with IOException
java.io.IOException: response already committed
at weblogic.servlet.jsp.JspWriterImpl.clear(JspWriterImpl.java:82)
at jsp_servlet.__image._jspService(__image.java:172)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:96)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
jsp部分代码如下:
OutputStream output = response.getOutputStream();
// 输出图象到页面
ImageIO.write(image, "JPEG", output);
output.flush();
output.close();
out.clear();
out = pageContext.pushBody();
查阅网上资料有人说去掉
out.clear();
out = pageContext.pushBody();
但是如果去掉的话,在tomcat中报错。
查看weblogic.jar的源码JspWriterImpl:
public void clear() throws IOException {
if (this.response.isCommitted()) {
throw new IOException("response already committed");
}
this.co.clearBuffer();
}
public void clearBuffer() throws IOException {
this.co.clearBuffer();
}
于是将out.clear改为out.clearBuffer(),weblogic下不再报错
但验证码还是无法显示,请教?
已解决怎么解决的
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。