• 启动Tomcat服务提示java.io.IOException: 打开的文件过多


    最近遇到linux 启动tomcat服务提示java.io.IOException: 打开的文件过多问题,如下:
    21-Dec-2020 10:43:44.972 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/tomcat_guomi/webapps/iotAuth has finished in 7,454 ms
    21-Dec-2020 10:43:44.975 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8090"]
    21-Dec-2020 10:43:44.979 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8099"]
    21-Dec-2020 10:43:44.984 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 7484 ms
    Exception in thread "mysql-cj-abandoned-connection-cleanup" java.lang.NoClassDefFoundError: com/mysql/cj/protocol/ExportControlled
            at com.mysql.cj.protocol.NetworkResources.forceClose(NetworkResources.java:53)
            at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread$ConnectionFinalizerPhantomReference.finalizeResources(AbandonedConnectionCleanupThread.java:237)
            at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.finalizeResource(AbandonedConnectionCleanupThread.java:215)
            at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:87)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.ClassNotFoundException: com.mysql.cj.protocol.ExportControlled
            at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
            at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
            ... 7 more
    21-Dec-2020 10:45:52.037 SEVERE [http-nio-8090-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:682)
            at java.lang.Thread.run(Thread.java:748)
    
    21-Dec-2020 10:45:52.088 SEVERE [http-nio-8090-Acceptor-0] org.apache.tomcat.util.net.NioEndpoint$Acceptor.run Socket accept failed
    

    解决办法:

      查看配置

    [root@localhost logs]# ulimit -a
    core file size          (blocks, -c) 0
    data seg size           (kbytes, -d) unlimited
    scheduling priority             (-e) 0
    file size               (blocks, -f) unlimited
    pending signals                 (-i) 62605
    max locked memory       (kbytes, -l) unlimited
    max memory size         (kbytes, -m) unlimited
    open files                      (-n) 1024
    pipe size            (512 bytes, -p) 8
    POSIX message queues     (bytes, -q) 819200
    real-time priority              (-r) 0
    stack size              (kbytes, -s) 8192
    cpu time               (seconds, -t) unlimited
    max user processes              (-u) 62605
    virtual memory          (kbytes, -v) unlimited
    file locks                      (-x) unlimited

    修改配置:

    [root@localhost logs]# ulimit -n 10240
    
    [root@localhost logs]# ulimit -a
    core file size          (blocks, -c) 0
    data seg size           (kbytes, -d) unlimited
    scheduling priority             (-e) 0
    file size               (blocks, -f) unlimited
    pending signals                 (-i) 62605
    max locked memory       (kbytes, -l) unlimited
    max memory size         (kbytes, -m) unlimited
    open files                      (-n) 10240
    pipe size            (512 bytes, -p) 8
    POSIX message queues     (bytes, -q) 819200
    real-time priority              (-r) 0
    stack size              (kbytes, -s) 8192
    cpu time               (seconds, -t) unlimited
    max user processes              (-u) 62605
    virtual memory          (kbytes, -v) unlimited
    file locks                      (-x) unlimited
    [root@localhost logs]# 

    在此窗口下再次启动服务(注意:在此窗口下):

    就不再报错了。

  • 相关阅读:
    顶尖操盘手买入规则
    一个网友在评论见义勇为时候应该注意事项
    20111215 白糖空头控盘下的多头陷阱(与魂灵共舞)
    近期au黄金市场的探讨(2011年12月27日)
    ASP.NET MVC 中,手动移除已注册到容器的规则方法
    VS2010功能——任务列表
    关于SQL排序,父条件对应子条件排序
    确保每一步的业务代码都能够正确执行。
    C#程序代码中常用的快捷键
    cmd 下创建新文件(不是文件夹)
  • 原文地址:https://www.cnblogs.com/johnson-yuan/p/14168096.html
Copyright © 2020-2023  润新知