简体   繁体   English

Jersey,写入响应消息时发生 I/O 错误

[英]Jersey, An I/O error has occurred while writing a response message

I use SpringBoot and Jersey into my project and I often tackle the following error:我在我的项目中使用了 SpringBoot 和 Jersey,我经常遇到以下错误:

[ERROR - ServerRuntime$Responder - 2018-02-13 13:16:45,983] An I/O error has occurred while writing a response message entity to the container output stream.
org.glassfish.jersey.server.internal.process.MappableException: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
        at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:92)
        at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
        at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130)
        at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:711)
        at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444)
        at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434)
        at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:329)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)

It results with a 503 status response to my client.结果是对我的客户的 503 状态响应。 Could you explain me why this error occured?你能解释一下为什么会出现这个错误吗?

Thanks谢谢

I have had this exception when I accidentally passed a null Response at the end of a call.当我在通话结束时不小心传递了 null 响应时,我遇到了这个异常。 You can verify this in the'caused by' section following the first exception:您可以在第一个异常之后的“由”部分验证这一点:

Caused by: org.eclipse.jetty.io.EofException: null引起:org.eclipse.jetty.io.EofException:null

This kind of error usually happens servlet is writing data back on the stream and connection closed from client side. 这种错误通常发生在servlet将数据写回到流上并从客户端关闭连接的情况下。 It is like server in sending some data may be file, string, bytes etc.. but on client side like a browser has closed the connection, like you close the browser tab. 就像服务器在发送一些数据时可能是文件,字符串,字节等。但是在客户端,就像浏览器已经关闭了连接,就像您关闭了浏览器选项卡。 It cased early End of file exception on the server. 它导致服务器上的文件结束提前异常。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM