gpt4 book ai didi

java - 如何捕捉并忽略 org.apache.catalina.connector.ClientAbortException

转载 作者:太空狗 更新时间:2023-10-29 22:44:34 26 4
gpt4 key购买 nike

我想捕获并忽略以下 tomcat ClientAbortException。因为我的程序不需要关注这个。

知道如何以及在何处捕获此异常吗?以下是异常(exception)情况:

14:46:43.920 [ajp-bio-8029-exec-538] ERROR com.sok.runway.URLFilter - Exception in URLFilter
org.apache.catalina.connector.ClientAbortException: null
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:388) ~[catalina.jar:7.0.26]
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:462) ~[tomcat-coyote.jar:7.0.26]
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:366) ~[tomcat-coyote.jar:7.0.26]
at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:413) ~[catalina.jar:7.0.26]
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:401) ~[catalina.jar:7.0.26]
at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:91) ~[catalina.jar:7.0.26]
at org.apache.catalina.servlets.DefaultServlet.copyRange(DefaultServlet.java:2031) ~[catalina.jar:7.0.26]
at org.apache.catalina.servlets.DefaultServlet.copy(DefaultServlet.java:1870) ~[catalina.jar:7.0.26]
at org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:958) ~[catalina.jar:7.0.26]
at org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:411) ~[catalina.jar:7.0.26]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) ~[servlet-api.jar:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) ~[servlet-api.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) [catalina.jar:7.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.26]
at com.sok.runway.URLFilter.doFilter(URLFilter.java:130) ~[runway-dev.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.26]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) [catalina.jar:7.0.26]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) [catalina.jar:7.0.26]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) [catalina.jar:7.0.26]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) [catalina.jar:7.0.26]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) [catalina.jar:7.0.26]
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) [catalina.jar:7.0.26]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) [catalina.jar:7.0.26]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) [catalina.jar:7.0.26]
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:200) [tomcat-coyote.jar:7.0.26]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579) [tomcat-coyote.jar:7.0.26]
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307) [tomcat-coyote.jar:7.0.26]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.7.0_03]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [na:1.7.0_03]
at java.lang.Thread.run(Thread.java:722) [na:1.7.0_03]
Caused by: java.net.SocketException: Connection reset
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113) ~[na:1.7.0_03]
at java.net.SocketOutputStream.write(SocketOutputStream.java:153) ~[na:1.7.0_03]
at org.apache.coyote.ajp.AjpProcessor.output(AjpProcessor.java:295) [tomcat-coyote.jar:7.0.26]
at org.apache.coyote.ajp.AbstractAjpProcessor$SocketOutputBuffer.doWrite(AbstractAjpProcessor.java:1082) ~[tomcat-coyote.jar:7.0.26]
at org.apache.coyote.Response.doWrite(Response.java:533) ~[tomcat-coyote.jar:7.0.26]
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:383) ~[catalina.jar:7.0.26]

最佳答案

因为您可能不希望依赖于 Catalina,您可以像这样忽略异常(我假设 ClientAbortException 是原因):

String simpleName = e.getCause().getClass().getSimpleName();
if (simpleName.equals("ClientAbortException")) {
// ignore
} else {
// do whatever you do
}

关于java - 如何捕捉并忽略 org.apache.catalina.connector.ClientAbortException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20510214/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com