0

对于 Java EE 应用程序,我不时在日志中收到 SocketException。造成这种情况的原因之一是浏览器突然被终止。

我怎样才能捕捉到这些错误?因为它们不会出现在我可以用 try-catch 包围的特定方法中。

Caused by: ClientAbortException:  java.net.SocketException: Connection reset by peer: socket write error
    at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:346)
    at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:306)
    at org.apache.catalina.connector.Response.flushBuffer(Response.java:572)
    at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:307)
    at org.apache.openejb.server.httpd.ServletResponseAdapter.flushBuffer(ServletResponseAdapter.java:205)
    at org.apache.cxf.transport.http.AbstractHTTPDestination$WrappedOutputStream.close(AbstractHTTPDestination.java:726)
    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
    at org.apache.cxf.transport.http.AbstractHTTPDestination$BackChannelConduit.close(AbstractHTTPDestination.java:655)
    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
    ... 24 more
Caused by: java.net.SocketException: Connection reset by peer: socket write error
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(Unknown Source)
    at java.net.SocketOutputStream.write(Unknown Source)
    at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:215)
    at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:462)
    at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:119)
    at org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:790)
    at org.apache.coyote.Response.action(Response.java:174)
    at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:341)
    ... 32 more
4

1 回答 1

0

这是内部 tomcat 日志记录。您需要更改 tomcat 的配置,甚至修改源代码。Tomcat 有大量的日志记录文档。

于 2012-11-30T16:30:10.187 回答