简体   繁体   English

iframe导致ClientAbortException:org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:369)中的java.io.IOException

[英]iframe causes ClientAbortException: java.io.IOException at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:369)

I'm using the iframe for showing a pdf file, with the posibility for the user to save it, print it, etc. But when the user navigates back or elsewhere this error ist always thrown: 我正在使用iframe来显示pdf文件,用户可以保存它,打印它等等。但是当用户导航回来或其他地方时,总会抛出这个错误:

ClientAbortException:  java.io.IOException
    at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:369)
    at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:448)
    at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:363)
    at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:392)
    at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:381)
    at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89)
    at java.nio.channels.Channels$WritableByteChannelImpl.write(Channels.java:296)
    at com.sun.faces.application.resource.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:277)
    at javax.faces.application.ResourceHandlerWrapper.handleResourceRequest(ResourceHandlerWrapper.java:119)
    at org.primefaces.application.PrimeResourceHandler.handleResourceRequest(PrimeResourceHandler.java:91)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:310)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)
    at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)
    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)
    at java.lang.Thread.run(Thread.java:662)

What can I do? 我能做什么?

ClientAbortException

Generally, you can just ignore it. 通常,您可以忽略它。 This exception will be thrown when the client has abruptly aborted the HTTP request while the page is still loading. 当客户端在页面仍在加载时突然中止HTTP请求时,将抛出此异常。 This will occur when the client pressed Esc , or hastily navigated away, or closed the browser, or got network outage, or even caught fire. 当客户端按下Esc ,或者仓促导航,关闭浏览器,或者网络中断,甚至着火时,都会发生这种情况。 All of this is totally out your control. 所有这些完全是你无法控制的。

The stacktrace indicates that it's a JSF resource request as handled by <h:outputStylesheet> , <h:outputScript> and <h:graphicImage> (and the PrimeFaces equivalents). stacktrace表示它是由<h:outputStylesheet><h:outputScript><h:graphicImage> (以及PrimeFaces等价物)处理的JSF资源请求。 So this was happening while the browser is trying to download a CSS, JS and/or image resource. 因此,当浏览器尝试下载CSS,JS和/或图像资源时,就会发生这种情况。

Well, you've just to "live with it". 好吧,你只是“和它一起生活”。 If you bother about the "noise" in the server logs, you could consider to create a servlet filter which suppresses those exceptions. 如果您对服务器日志中的“噪音”感到烦恼,可以考虑创建一个servlet过滤器来抑制这些异常。

try {
    chain.doFilter(request, response);
} catch (ClientAbortException e) {
    // Log a single line instead of whole stacktrace, or just ignore it.
}

Please note that this is a servletcontainer-specific exception class (from Catalina/Tomcat) and thus such a filter is this way tight coupled to the specific servletcontainer make (ie it's not portable to Glassfish or others). 请注意,这是一个特定于servlet容器的异常类(来自Catalina / Tomcat),因此这种过滤器与特定的servletcontainer make紧密耦合(即它不能移植到Glassfish或其他人)。 As it's a subclass of IOException , you might want to catch it instead and do a Class#getSimpleName() check. 因为它是IOException的子类,所以您可能希望捕获它并执行Class#getSimpleName()检查。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring 应用程序部署在 tomcat - org.apache.catalina.connector.ClientAbortException: java.io.IOException: Connection reset by peer - Spring application deployed on tomcat - org.apache.catalina.connector.ClientAbortException: java.io.IOException: Connection reset by peer ClientAbortException:大文件上载期间的java.io.IOException - ClientAbortException: java.io.IOException during big file upload java.io.IOException:org.apache.camel.NoTypeConversionAvailableException - java.io.IOException: org.apache.camel.NoTypeConversionAvailableException org.glassfish.jersey.server.internal.process.MappableException: org.apache.catalina.connector.ClientAbortException: java.net.SocketException: - org.glassfish.jersey.server.internal.process.MappableException: org.apache.catalina.connector.ClientAbortException: java.net.SocketException: 如何修复java下载按钮连续单击ClientAbortException:java.io.IOException错误? - How fix java download button continuous click ClientAbortException: java.io.IOException error? 如何捕获和忽略org.apache.catalina.connector.ClientAbortException - How to catch and Ignore org.apache.catalina.connector.ClientAbortException 异常java.io.IOException失败:org.apache.avro.AvroTypeException:发现很长,期待在hive中联合 - Failed with exception java.io.IOException:org.apache.avro.AvroTypeException: Found long, expecting union in hive 我正在org.apache.hadoop.ipc.RemoteException:Mapreduce作业中的java.io.IOException? - I am getting org.apache.hadoop.ipc.RemoteException: java.io.IOException in Mapreduce job? java.io.IOException:org.apache.thrift.protocol.TProtocolException:无法编写没有设置值的TUnion - java.io.IOException: org.apache.thrift.protocol.TProtocolException: Cannot write a TUnion with no set value Exception in thread "main" org.apache.hadoop.ipc.RemoteException(java.io.IOException) for hadoop 3.1.3 - Exception in thread "main" org.apache.hadoop.ipc.RemoteException(java.io.IOException) for hadoop 3.1.3
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM