简体   繁体   English

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:

I am new to Jersey & tomcat.我是泽西岛和 tomcat 的新手。 I have a webservice hosted on tomcat7 which returns a zip file after some processing.我有一个托管在 tomcat7 上的网络服务,它在一些处理后返回一个 zip 文件。
I am getting below exception我低于异常

org.glassfish.jersey.server.internal.process.MappableException: org.apache.catalina.connector.ClientAbortException: java.net.SocketException: Connection timed out (Write failed)
    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)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
    at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:221)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.connector.ClientAbortException: java.net.SocketException: Connection timed out (Write failed)
    at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:407)
    at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:371)
    at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:432)
    at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:420)
    at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:91)
    at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:84)
    at org.glassfish.jersey.servlet.internal.ResponseWriter$NonCloseableOutputStreamWrapper.write(ResponseWriter.java:320)
    at org.glassfish.jersey.message.internal.CommittingOutputStream.write(CommittingOutputStream.java:218)
    at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$UnCloseableOutputStream.write(WriterInterceptorExecutor.java:294)
    at org.glassfish.jersey.message.internal.ByteArrayProvider.writeTo(ByteArrayProvider.java:96)
    at org.glassfish.jersey.message.internal.ByteArrayProvider.writeTo(ByteArrayProvider.java:60)
    at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)
    at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250)
    at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
    at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106)
    at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
    at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86)
    ... 39 more
Caused by: java.net.SocketException: Connection timed out (Write failed)
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
    at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:215)
    at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:480)
    at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:366)
    at org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:240)
    at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:119)
    at org.apache.coyote.http11.AbstractOutputBuffer.doWrite(AbstractOutputBuffer.java:192)
    at org.apache.coyote.Response.doWrite(Response.java:499)
    at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:402)
    ... 55 more


This code works fine with smaller file created in shorter time but gives exception in case file having size 700-800kb, after some processing of approximately 6-8minutes.此代码适用于在更短的时间内创建的较小文件,但在经过大约 6-8 分钟的一些处理后,如果文件大小为 700-800kb,则会出现异常。

PS : The request comes to webservice hosted on tomcat & then goes for RMI call to different VM via load balancer. PS:请求来自托管在 tomcat 上的 webservice,然后通过负载均衡器对不同的 VM 进行 RMI 调用。

According to the exception information & your description, based on my understanding, I think the issue was caused by the synchronous processing mode of Jersey which require as below.根据异常信息和您的描述,根据我的理解,我认为问题是由 Jersey 的同步处理模式引起的,需要如下。

Request processing on the server works by default in a synchronous processing mode, which means that a client connection of a request is processed in a single I/O container thread.服务器上的请求处理默认工作在同步处理模式下,这意味着请求的客户端连接在单个 I/O 容器线程中处理。 Once the thread processing the request returns to the I/O container, the container can safely assume that the request processing is finished and that the client connection can be safely released including all the resources associated with the connection.一旦处理请求的线程返回到 I/O 容器,容器就可以安全地假设请求处理已完成,并且可以安全地释放客户端连接,包括与该连接关联的所有资源。 This model is typically sufficient for processing of requests for which the processing resource method execution takes a relatively short time.该模型通常足以处理处理资源方法执行所需时间相对较短的请求。 However, in cases where a resource method execution is known to take a long time to compute the result, server-side asynchronous processing model should be used.但是,在已知资源方法执行需要很长时间来计算结果的情况下,应使用服务器端异步处理模型。 In this model, the association between a request processing thread and client connection is broken.在这个模型中,请求处理线程和客户端连接之间的关联被破坏了。 I/O container that handles incoming request may no longer assume that a client connection can be safely closed when a request processing thread returns.处理传入请求的 I/O 容器可能不再假设当请求处理线程返回时可以安全地关闭客户端连接。 Instead a facility for explicitly suspending, resuming and closing client connections needs to be exposed.相反,需要公开用于显式挂起、恢复和关闭客户端连接的工具。 Note that the use of server-side asynchronous processing model will not improve the request processing time perceived by the client.请注意,使用服务器端异步处理模型不会提高客户端感知的请求处理时间。 It will however increase the throughput of the server, by releasing the initial request processing thread back to the I/O container while the request may still be waiting in a queue for processing or the processing may still be running on another dedicated thread.然而,它会增加服务器的吞吐量,通过将初始请求处理线程释放回 I/O 容器,同时请求可能仍在队列中等待处理,或者处理可能仍在另一个专用线程上运行。 The released I/O container thread can be used to accept and process new incoming request connections.释放的 I/O 容器线程可用于接受和处理新的传入请求连接。

So in the case without your codes, my suggestion is that please refer to the jersey offical document 11.1. Asynchronous Server API所以在没有你的代码的情况下,我的建议是请参考球衣官方文档11.1. Asynchronous Server API 11.1. Asynchronous Server API to rewrite the code for processing zip files.用于重写处理 zip 文件的代码的11.1. Asynchronous Server API Hope it helps.希望能帮助到你。

暂无
暂无

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

相关问题 如何捕获和忽略org.apache.catalina.connector.ClientAbortException - How to catch and Ignore org.apache.catalina.connector.ClientAbortException 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 NoClassDefFoundError:org / glassfish / jersey / process / internal / RequestExecutorFactory - NoClassDefFoundError: org/glassfish/jersey/process/internal/RequestExecutorFactory 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) TThreadPoolServer客户端org.apache.thrift.transport.TTransportException:java.net.SocketException:管道损坏 - TThreadPoolServer Clients org.apache.thrift.transport.TTransportException: java.net.SocketException: Broken pipe ClientAbortException:java.net.SocketException:连接重置错误间歇性地出现在jboss服务器上 - ClientAbortException: java.net.SocketException: Connection reset error coming intermittently on jboss server 信号服务器错误:org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException - Signal Server Error: org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException java.lang.ClassNotFoundException:org.apache.catalina.connector.Response - java.lang.ClassNotFoundException: org.apache.catalina.connector.Response java.lang.NoClassDefFoundError: org/glassfish/jersey/internal/inject/Binder 启动 Tomcat 服务器时 - java.lang.NoClassDefFoundError: org/glassfish/jersey/internal/inject/Binder when started Tomcat Server 钻探到Hive连接错误(org.apache.thrift.transport.TTransportException java.net.SocketException:管道断开(写入失败)) - Drill to Hive connectivity error(org.apache.thrift.transport.TTransportException java.net.SocketException: Broken pipe (Write failed))
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM