您好,登錄后才能下訂單哦!
這篇文章主要介紹了如何解決Tomcat重新配置后啟動慢的問題,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
Jenkins+Tomcat服務器配置過程中,修改了tomcat配置文件;然后再訪問服務器的tomcat頁面發現根本加載不出來
企圖重啟tomcat
/opt/tomcat/bin/shutdown.sh
出現如下報錯
[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 二月 20, 2020 1:37:22 下午 org.apache.catalina.startup.Catalina stopServer 嚴重: Could not contact [localhost:8005]. Tomcat may not be running. 二月 20, 2020 1:37:22 下午 org.apache.catalina.startup.Catalina stopServer 嚴重: 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.<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)
經查證,出現這種報錯的原因是Tomcat尚未啟動完成;
接下來嘗試了強制關閉tomcat
ps -ef | grep tomcat 查看tomcat進程號 kill -9 + 進程號 殺死進程
重新啟動tomcat
/opt/tomcat/bin/startup.sh
tomcat頁面依舊無法加載
打印tomcat運行日志
[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:48:35.239 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/opt/tomcat 20-Feb-2020 13:48:35.239 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/tomcat 20-Feb-2020 13:48:35.239 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/opt/tomcat/temp 20-Feb-2020 13:48:35.239 信息 [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:48:35.348 信息 [main] org.apache.coyote.AbstractProtocol.init 初始化協議處理器 ["http-nio-8080"] 20-Feb-2020 13:48:35.391 信息 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 20-Feb-2020 13:48:35.403 信息 [main] org.apache.catalina.startup.Catalina.load Initialization processed in 895 ms 20-Feb-2020 13:48:35.487 信息 [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina] 20-Feb-2020 13:48:35.487 信息 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.51 20-Feb-2020 13:48:35.524 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory 把web 應用程序部署到目錄 [/opt/tomcat/webapps/docs]
發現運行日志卡在最后一行:localhost-startStop-1
,無法向下繼續進行
解決方案:
將$ JAVA_HOME / jre / lib / security / java.security
文件中的securerandom.source
參數修改為文件:/ 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
順帶一提,在vi中快速搜索的方法:
命令模式下輸入“/字符串”,例如“/Section 3”。如果查找下一個,按“n”即可。
感謝你能夠認真閱讀完這篇文章,希望小編分享的“如何解決Tomcat重新配置后啟動慢的問題”這篇文章對大家有幫助,同時也希望大家多多支持億速云,關注億速云行業資訊頻道,更多相關知識等著你來學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。