ClientAbortException:java.net.SocketException:由peer重置连接:套接字写入错误

时间:2009-05-08 10:58:47

标签: java tomcat socketexception connection-reset

从数据库列检索文件对象时,我经常收到以下错误。我该如何解决这个问题?

May 8, 2009 3:18:14 PM org.apache.catalina.core.StandardHostValve status
  WARNING: Exception Processing ErrorPage[errorCode=404, location=/error.jsp]
  ClientAbortException:  java.net.SocketException: Connection reset by peer: socket write error
  at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:327)
  at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:293)
  at org.apache.catalina.connector.Response.flushBuffer(Response.java:537)
  at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:286)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
  at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
  at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)        
  at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
  at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
  at java.lang.Thread.run(Unknown Source)

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:746)
  at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:433)
  at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:304)
  at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:991)
  at org.apache.coyote.Response.action(Response.java:182)
  at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:322)
  ... 13 more

4 个答案:

答案 0 :(得分:33)

您的HTTP客户端已断开连接。

这可能有几个原因:

  • 响应请求花了太长时间,客户放弃了
  • 您回复了客户不理解的内容
  • 最终用户实际取消了请求
  • 发生网络错误
  • ......可能更多

您可以相当轻松地模拟行为:

URL url = new URL("http://example.com/path/to/the/file");

int numberOfBytesToRead = 200;

byte[] buffer = new byte[numberOfBytesToRead];
int numberOfBytesRead = url.openStream().read(buffer);

答案 1 :(得分:8)

您的日志表示ClientAbortException,当您的HTTP客户端断开与服务器的连接时发生这种情况,这发生在服务器关闭服务器套接字连接之前。

答案 2 :(得分:0)

I have got this error on open page from Google Cache.

I think, cached page(client) disconnecting on page loading.

You can ignore this error log with try-catch on filter.

答案 3 :(得分:-2)

Windows防火墙可能会导致此异常,尝试禁用它或为端口甚至程序添加规则(java)