org.apache.tomcat.util.net.Nio2Endpoint$Nio2Acceptor.failed 套接字接受失败 解决办法

严重 [http-nio-18090-Acceptor-0] org.apache.tomcat.util.net.NioEndpoint$Acceptor.run Socket accept failed
 java.io.IOException: 打开的文件过多
    at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
    at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:422)
    at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:250)
    at org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:692)
    at java.lang.Thread.run(Thread.java:748)

在server.xml中修改如下一段

<Server port="8000" shutdown="SHUTDOWN" debug="0">
    <Service name="Tomcat-Standalone">
        <Connector port="18090" connectionTimeout="20000" redirectPort="8443"
                maxThreads="48" minSpareThreads="10"
                enableLookups="false" acceptCount="1" URIEncoding="UTF-8"
                protocol="org.apache.coyote.http11.Http11NioProtocol" />

修改为:

<Server port="8000" shutdown="SHUTDOWN" debug="0">
    <Service name="Tomcat-Standalone">
        <Connector port="18090" connectionTimeout="20000" redirectPort="8443"
                maxThreads="48" minSpareThreads="10"
                enableLookups="false" acceptCount="100" URIEncoding="UTF-8"
                protocol="org.apache.coyote.http11.Http11NioProtocol" />

acceptCount="1"修改为acceptCount="100"即可

 

以下还没找到办法解决

01-Feb-2023 07:30:24.481 严重 [Thread-641] org.apache.tomcat.util.net.Nio2Endpoint$Nio2Acceptor.failed 套接字接受失败
    java.io.IOException: 由于线程退出或应用程序请求,已中止 I/O 操作。
        at java.base/sun.nio.ch.Iocp.translateErrorToIOException(Iocp.java:299)
        at java.base/sun.nio.ch.Iocp$EventHandlerTask.run(Iocp.java:389)
        at java.base/sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:113)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)

posted @ 2023-02-01 08:18  锐洋智能  阅读(1005)  评论(0编辑  收藏  举报