org.apache.catalina.connector.ClientAbortException: java.io.IOException: 断开的管道

简介: org.apache.catalina.connector.ClientAbortException: java.io.IOException: 断开的管道

当把项目Nginx作负载均衡时,有些时间较长的请求,Tomcat就报如下错误:

org.apache.catalina.connector.ClientAbortException: java.io.IOException: 断开的管道 at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer. at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk. at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer. at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer. at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream. at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder. at sun.nio.cs.StreamEncoder.flush(StreamEncoder. at at org.springframework.util.StreamUtils.copy(StreamUtils. at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter. at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter. at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter. at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor. at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor. at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor. at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite. at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod. at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter. at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter. at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter. at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet. at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet. at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet. at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet. at at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet. at at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain. at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain. at org.jasig.cas.client.util.AssertionThreadLocalFilter.doFilter(AssertionThreadLocalFilter. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain. at org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain. at com.bfd.filter.CASFilter.doFilter(CASFilter. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain. at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain. at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter. at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain. at com.bfd.filter.CrossDomainFilter.doFilter(CrossDomainFilter. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain. at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain. at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter. at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain. at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve. at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve. at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase. at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve. at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve. at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve. at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter. at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor. at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol. at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint. at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint. at at at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread. at Caused by: java.io.IOException: 断开的管道 at sun.nio.ch.FileDispatcherImpl.write0(Native Method) at sun.nio.ch.SocketDispatcher.write(SocketDispatcher. at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil. at sun.nio.ch.IOUtil.write(IOUtil. at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl. at org.apache.tomcat.util.net.NioChannel.write(NioChannel. at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector. at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool. at org.apache.coyote.http11.InternalNioOutputBuffer.writeToSocket(InternalNioOutputBuffer. at org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer. at org.apache.coyote.http11.InternalNioOutputBuffer.access$000(InternalNioOutputBuffer. at org.apache.coyote.http11.InternalNioOutputBuffer$SocketOutputBuffer.doWrite(InternalNioOutputBuffer. at org.apache.coyote.http11.filters.IdentityOutputFilter.doWrite(IdentityOutputFilter. at org.apache.coyote.http11.AbstractOutputBuffer.doWrite(AbstractOutputBuffer. at org.apache.coyote.Response.doWrite(Response. at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer. ... 73 mo

如上报错原因就是连接断开了。 具体错在哪里呐: 最后发现问题在Nginx,发现Nginx的连接超时时间设计的太短了,当服务器处理时间比较长时,等返回结果时,Nginx端已经超时断链了,Tomcat就报错了。解决方法就是把Nginx时间调大一点,就行。

相关文章
|
4天前
|
Java 数据库连接 数据库
深入探讨Java连接池技术如何通过复用数据库连接、减少连接建立和断开的开销,从而显著提升系统性能
在Java应用开发中,数据库操作常成为性能瓶颈。本文通过问题解答形式,深入探讨Java连接池技术如何通过复用数据库连接、减少连接建立和断开的开销,从而显著提升系统性能。文章介绍了连接池的优势、选择和使用方法,以及优化配置的技巧。
10 1
|
26天前
|
分布式计算 Java 大数据
大数据-147 Apache Kudu 常用 Java API 增删改查
大数据-147 Apache Kudu 常用 Java API 增删改查
25 1
|
2月前
|
IDE Java 分布式数据库
Apache HBase 落地JAVA 实战
Apache HBase 落地 Java 实战主要涉及使用 Java API 来操作 HBase 数据库,包括表的创建、删除、数据的插入、查询等操作。以下是一个基于 Java 的 HBase 实战指南,包括关键步骤和示例代码。
162 23
|
1月前
|
Java Apache
Apache POI java对excel表格进行操作(读、写) 有代码!!!
文章提供了使用Apache POI库在Java中创建和读取Excel文件的详细代码示例,包括写入数据到Excel和从Excel读取数据的方法。
31 0
|
3月前
|
消息中间件 Java Kafka
【Azure 事件中心】在微软云中国区 (Mooncake) 上实验以Apache Kafka协议方式发送/接受Event Hubs消息 (Java版)
【Azure 事件中心】在微软云中国区 (Mooncake) 上实验以Apache Kafka协议方式发送/接受Event Hubs消息 (Java版)
|
3月前
|
Java 持续交付 项目管理
Maven是一款基于Apache许可的项目管理和构建自动化工具,在Java开发中极为流行。
Maven是一款基于Apache许可的项目管理和构建自动化工具,在Java开发中极为流行。它采用项目对象模型(POM)来描述项目,简化构建流程。Maven提供依赖管理、标准构建生命周期、插件扩展等功能,支持多模块项目及版本控制。在Java Web开发中,Maven能够自动生成项目结构、管理依赖、自动化构建流程并运行多种插件任务,如代码质量检查和单元测试。遵循Maven的最佳实践,结合持续集成工具,可以显著提升开发效率和项目质量。
49 1
|
3月前
|
Java 前端开发 Apache
Apache Wicket与Spring MVC等Java Web框架大PK,究竟谁才是你的最佳拍档?点击揭秘!
【8月更文挑战第31天】在Java Web开发领域,众多框架各具特色。Apache Wicket以组件化开发和易用性脱颖而出,提高了代码的可维护性和可读性。相比之下,Spring MVC拥有强大的生态系统,但学习曲线较陡;JSF与Java EE紧密集成,但在性能和灵活性上略逊一筹;Struts2虽成熟,但在RESTful API支持上不足。选择框架时还需考虑社区支持和文档完善程度。希望本文能帮助开发者找到最适合自己的框架。
41 0
|
5月前
|
消息中间件 存储 Java
深度探索:使用Apache Kafka构建高效Java消息队列处理系统
【6月更文挑战第30天】Apache Kafka是分布式消息系统,用于高吞吐量的发布订阅。在Java中,开发者使用Kafka的客户端库创建生产者和消费者。生产者发送序列化消息到主题,消费者通过订阅和跟踪偏移量消费消息。Kafka以持久化、容灾和顺序写入优化I/O。Java示例代码展示了如何创建并发送/接收消息。通过分区、消费者组和压缩等策略,Kafka在高并发场景下可被优化。
116 1
|
5月前
|
Java 应用服务中间件 Apache
安装和配置Apache Tomcat是部署Java Web应用程序的常见任务
安装和配置Apache Tomcat是部署Java Web应用程序的常见任务
139 7
|
5月前
|
缓存 NoSQL Redis
redis管道操作(节省网络IO开销)
pipeline中发送的每个command都会被server立即执行,如果执行失败,将会在此后的响应中得到信息;也就是pipeline并不是表达“所有command都一起成功”的语义,管道中前面命令失败,后面命令不会有影响,继续执行。
47 1