Jenkins+Tomcat服務器配置過程中,修改了tomcat配置文件;然后再訪問服務器的tomcat頁面發(fā)現(xiàn)根本加載不出來
企圖重啟tomcat
/opt/tomcat/bin/shutdown.sh
出現(xiàn)如下報錯
[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)
經(jīng)查證,出現(xiàn)這種報錯的原因是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 初始化協(xié)議處理器 ["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]
發(fā)現(xiàn)運行日志卡在最后一行:localhost-startStop-1
,無法向下繼續(xù)進行
解決方案:
將$ JAVA_HOME / jre / lib / security / java.security
文件中的securerandom.source
參數(shù)修改為文件:/ 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重新配置后啟動慢的問題的詳細內容,更多關于tomcat啟動慢請關注腳本之家其它相關文章!