当前位置:首页 > 服务端 > 启动Tomcat服务提示java.io.IOException: 打开的文件过多

启动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]# 

 

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

就不再报错了。

作者:Johnson_Yuan
来源链接:https://www.cnblogs.com/johnson-yuan/p/14168096.html

版权声明:
1、Java侠(https://www.javaxia.com)以学习交流为目的,由作者投稿、网友推荐和小编整理收藏优秀的IT技术及相关内容,包括但不限于文字、图片、音频、视频、软件、程序等,其均来自互联网,本站不享有版权,版权归原作者所有。

2、本站提供的内容仅用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律的规定,不得侵犯相关权利人及本网站的合法权利。
3、本网站内容原作者如不愿意在本网站刊登内容,请及时通知本站(javaclubcn@163.com),我们将第一时间核实后及时予以删除。





本文链接:https://www.javaxia.com/server/125646.html

标签: IOException
分享给朋友:

“启动Tomcat服务提示java.io.IOException: 打开的文件过多” 的相关文章