Quickly solve the problem of slow startup after Tomcat reconfiguration

  • 2021-07-26 09:05:35
  • OfStack

In the process of Jenkins+Tomcat server configuration, the tomcat configuration file was modified; Then visit the server's tomcat page and find that it can't be loaded at all

Attempt to restart tomcat

/opt/tomcat/bin/shutdown.sh

The following error is reported

[root @ izbp1fmfc2pdjiw9u143xfz conf] #/opt/tomcat/bin/shutdown.sh Using CATALINA_BASE:/opt/tomcat CATALINA_HOME:/opt/tomcat Using CATALINA_TMPDIR:/opt/tomcat/Using JRE_HOME:/usr/lib/jvm/java-1. 8.0 53EN:/opt/tomcat/bin/bootstrap. jar:/opt/tomcat/bin/tomcat-juli February 20, 2020 1:37:22 PM org. apache. catalina. startup stopServer Serious: Could not contact [localhost: 8005]. Tomcat may not not not be running. February 20, 2020 1:37:22 N Severe: Catalina. stop: java. net. ConnectException: Denied Connection (Connection refused) at java. net. PlainSocketImpl. socketConnect (Native Method) ES100java. net. AbstractPlainSocketImpl. net: 350) at java. net. AbstractPlainSocketImpl. connectToAddress (AbstractPlainSocketImpl. java: 206) at java N (AbstractPlainSocketImpl.java: 188) at java. net. SocksSocketImpl. connect (SocksSocketImpl. java: 392) at java. net. Socket. connect (Socket. java: 607) at java. net. Socket (Socket. java: 556) at java. net. Socket. < init > (Socket.java:452) at java.net.Socket. < init > (Socket.java:229) at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:504) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 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)

After verification, the reason for this error is that Tomcat has not been started yet;

Next, I tried to force tomcat to shut down


ps -ef | grep tomcat  View tomcat Process number 
kill -9 +  Process number   Kill process 

Restart tomcat

/opt/tomcat/bin/startup.sh

The tomcat page still cannot be loaded

Print tomcat running log

[root @ izbp1fmfc2pdjiw9u143xfz conf] # cd/opt/tomcat [root @ izbp1fmfc2pdjiw9u143ES193tomcat] # ls bin BUILDING CONTRIBUTING CONTRIBUTING CONTRIBUTING CONTRIBUTING CONTRIBUTING CONTRIBUTING CONTRIBUTING CONTRIBUTING CONTRIBUTING CONTRIBUTING CONTRIBUTING CONTRIBUTING 12EN 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 EN.2020-02-20. log manager. 2020-02-20. log [root @ izbp1fmfc2pdjiw9u143xfz catalina. out 20-Feb-2020 13: 48: 35. 239 Information [main] org. Dcatalina. startup. startup. line line argument:-Dcatalina. base=/opt/tomcat 20-Feb-2020 13: 48:35. 239 Information [main] org. apache. catalina. startup. log Command line argument:-Dcatalina. home=/opt/tomcat 20-Feb-2020 13: 48:35. 239 Information [main] org. apache. startup. VersionLoggerListener. log Command Command line argument 9EN. tmpdir=/opt/tomcat/temp 20-Feb-2020 13:48: 35.239 Information [main] org. apache. catalina. AprLifecycleListener. lifecycleEvent The APR based Apache Tomcat Native library allows optimal optimal performance in production environments was not found EN.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib] 20-Feb-2020 13:48:35. 348 Information [main] org. apache. Feb Initialization Protocol Processor ["http-nio-2020 13:48:35. 380"] 20-Feb-2020 13:48:35.. tomcat. util. net. NioSelectorPool. getSharedSelector Using selector selector servlet write/read 20-Feb-2020 13: 48: 35. 403 Information [main] org. apache. Catalina. Catalina. load Initialization Initialization 895 ms 20-Feb-2020 13: 48: 35. 487 Information [main 387EN. core. StandardService. startInternal Starting service [Catalina] 20-Feb-2020 13:48:35. 487 Information [main] org. apache. apache. catalina. Servlet Tomcat/8. 5.51 20-Feb-2020 13:48:35. 524 Information [localhost-2020 13:48:35. org. apache. startup. HostConfig 415EN Deploy web Applications to Directories [/opt/tomcat/webapps/docs]

Found the running log card in the last line: localhost-startStop-1 Unable to continue down

Solution:

Will $ JAVA_HOME / jre / lib / security / java.security In the file securerandom.source Parameter changed to file:/dev/./urandom


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

Incidentally, the method of quick search in vi:

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

Summarize

The above is a quick solution to the Tomcat reconfiguration after the slow start-up of the details, more about tomcat start-up slow please pay attention to other related articles on this site!


Related articles: