Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of slow start after Tomcat reconfiguration

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to solve the problem of slow start after Tomcat reconfiguration, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.

During the configuration of the Jenkins+Tomcat server, the tomcat configuration file was modified; then the tomcat page of the server was visited and found that it could not be loaded at all

Attempt to restart tomcat

/ opt/tomcat/bin/shutdown.sh

The following error occurred

[root@izbp1fmfc2pdjiw9u143xfz conf] # / opt/tomcat/bin/shutdown.sh Using CATALINA_BASE: / opt/tomcat Using CATALINA_HOME: / opt/tomcat Using CATALINA_TMPDIR: / opt/tomcat/temp Using JRE_HOME: / usr/lib/jvm/java-1.8.0-openjdk Using CLASSPATH: / opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar February 20 2020 1:37:22 afternoon org.apache.catalina.startup.Catalina stopServer serious: Could not contact [localhost:8005]. Tomcat may not be running. February 20th 2020 1:37:22 afternoon org.apache.catalina.startup.Catalina stopServer serious: Catalina.stop: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect (Native Method) at java.net.AbstractPlainSocketImpl.doConnect (AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress (AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect (AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect (SocksSocketImpl.java:392) at java.net.Socket. Connect (Socket.java:607) at java.net.Socket.connect (Socket.java:556) at java.net.Socket. (Socket.java:452) at java.net.Socket. (Socket.java:229) at org.apache.catalina.startup.Catalina.stopServer (Catalina.java:504) at sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethod) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method .invoke (Method.java:498) at org.apache.catalina.startup.Bootstrap.stopServer (Bootstrap.java:389) at org.apache.catalina.startup.Bootstrap.main (Bootstrap.java:479)

It has been verified that the reason for this error is that Tomcat has not yet been started.

Then I tried to force the shutdown of tomcat

Ps-ef | grep tomcat checks the tomcat process number kill-9 + process number kills the process

Restart tomcat

/ opt/tomcat/bin/startup.sh

The tomcat page still cannot be loaded

Print tomcat run log

[root@izbp1fmfc2pdjiw9u143xfz conf] # cd / opt/tomcat [root@izbp1fmfc2pdjiw9u143xfz tomcat] # ls bin BUILDING.txt conf CONTRIBUTING.md lib LICENSE logs NOTICE README.md RELEASE-NOTES RUNNING.txt temp webapps work [root@izbp1fmfc2pdjiw9u143xfz tomcat] # cd logs [root@izbp1fmfc2pdjiw9u143xfz logs] # ls catalina.2020-02-20.log host-manager.2020-02-20.log localhost_access_log.2020-02-20.txt catalina.out localhost.2020-02-20.log manager.2020-02-20.log [root@izbp1fmfc2pdjiw9u143xfz logs ] # tail-f catalina.out 20-Feb-2020 13 catalina.out 20-Feb-2020 48 main 35.239 Information [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument:-Dcatalina.base=/opt/tomcat 20-Feb-2020 13 main 48 org.apache.catalina.startup.VersionLoggerListener.log Command line argument 35.239 Information [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument:-Dcatalina.home=/opt/tomcat 20-Feb-2020 13 main 48 Swiss 35.239 Information [main] org.apache.catalina.startup.VersionLoggerListener Log Command line argument:-Djava.io.tmpdir=/opt/tomcat/temp 20-Feb-2020 13 org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path 48 log Command line argument 35.239 Information [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/ usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib] 20-Feb-2020 13 main 48 Freud 35.348 Information [main] org .apache.coyote.AbstractProtocol.init initialization protocol processor ["http-nio-8080"] 20-Feb-2020 13main 48VH 35.391 information [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 20-Feb-2020 13Rd 48Rd 35.403 information [main] org.apache.catalina.startup.Catalina.load Initialization processed in 895 ms 20-Feb-2020 13Rose 4835.487 information [main] org. Apache.catalina.core.StandardService.startInternal Starting service [Catalina] 20-Feb-2020 13 20-Feb-2020 48 main 35.487 Information [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.51 20-Feb-2020 13 20-Feb-2020 48 main 35.524 Information [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory deploy web applications to the directory [/ opt/tomcat/webapps/docs]

It is found that the running log card is on the last line: localhost-startStop-1, and cannot proceed down.

Solution:

Modify the securerandom.source parameter in the $JAVA_HOME / jre / lib / security / java.security file to the file: / dev /. / urandom

[root@izbp1fmfc2pdjiw9u143xfz logs] # cd $JAVA_HOME/jre/lib/ Security [root @ izbp1fmfc2pdjiw9u143xfz security] # lsblacklisted.certs cacerts java.policy java.security nss.cfg policy [root@izbp1fmfc2pdjiw9u143xfz security] # vi java.security

By the way, a quick search in vi:

Enter "/ string" in command mode, such as "/ Section 3". If you look for the next one, just press "n".

Thank you for reading this article carefully. I hope the article "how to solve the problem of slow start after Tomcat reconfiguration" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report