tomcat啟動錯誤整理(五)
阿新 • • 發佈:2019-01-04
1.使用startup命令無法啟動tomcat
[[email protected] ~]# ps -ef |grep tomcatAPP
root 14565 14548 0 11:09 pts/0 00:00:00 grep tomcatAPP
[[email protected] ~]# cd /usr/local/tomcatAPP
[[email protected] tomcatAPP]# ./bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcatAPP
Using CATALINA_HOME: /usr/local/tomcatAPP
Using CATALINA_TMPDIR: /usr/local/tomcatAPP/temp
Using JRE_HOME: /usr/local/jdk1.8.0_121
Using CLASSPATH: /usr/local/tomcatAPP/bin/bootstrap.jar:/usr/local/tomcatAPP/bin/tomcat-juli.jar
Tomcat started. # 顯示tomcat啟動
# 檢視是否成功啟動tomcat,結果是未成功啟動
[ [email protected] tomcatAPP]# ps -ef |grep tomcatAPP
root 14602 14548 0 11:09 pts/0 00:00:00 grep tomcatAPP
2.原因
在tomcat的server.xml中配置了虛擬目錄,訪問地址是/時預設訪問APPPortal目錄。
檢查webapps下的檔案時,發現沒有APPPortal目錄,導致tomcat啟動失敗。
[[email protected] tomcatAPP]# cat ./conf/server.xml .... <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <!-- Context中配置的是虛擬目錄,要求訪問/時,預設訪問APPPortal目錄 --> <Context path="/" docBase="APPPortal" debug="0" reloadable="true"/> <!-- SingleSignOn valve, share authentication between web applications Documentation at: /docs/config/valve.html --> <!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> --> <!-- Access log processes all example. Documentation at: /docs/config/valve.html Note: The pattern used is equivalent to using pattern="common" --> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host> </Engine> </Service> </Server>
[[email protected] tomcatAPP]# ll ./webapps/ # 檢視webapps下的檔案 total 1346400 drwxr-xr-x 14 root root 4096 Jun 6 2017 docs drwxr-xr-x 7 root root 4096 Jun 6 2017 examples drwxr-xr-x 5 root root 4096 Jun 6 2017 host-manager drwxr-xr-x 5 root root 4096 Jun 6 2017 manager -rw-r--r-- 1 root root 35196030 Jan 4 10:56 APPPortal.war--deploy -rw-r--r-- 1 root root 35192478 Dec 28 09:59 APPPortal.war--0102bak -rw-r--r-- 1 root root 35196204 Jan 3 17:10 APPPortal.war--0104bak # tomcat的webapps中沒有APPPortal.war檔案或APPPortal目錄 # APPPortal.war檔案在tomcat啟動時會自動解壓生成對應的APPPortal目錄
3.解決方案
釋放一個APPPortal.war檔案,啟動成功。
[[email protected] tomcatAPP]# ll ./webapps/
total 1346400
drwxr-xr-x 14 root root 4096 Jun 6 2017 docs
drwxr-xr-x 7 root root 4096 Jun 6 2017 examples
drwxr-xr-x 5 root root 4096 Jun 6 2017 host-manager
drwxr-xr-x 5 root root 4096 Jun 6 2017 manager
-rw-r--r-- 1 root root 35196030 Jan 4 10:56 APPPortal.war
-rw-r--r-- 1 root root 35192478 Dec 28 09:59 APPPortal.war--0102bak
-rw-r--r-- 1 root root 35196204 Jan 3 17:10 APPPortal.war--0104bak
# 使用startup啟動tomcat
[[email protected] tomcatAPP]# ./bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcatAPP
Using CATALINA_HOME: /usr/local/tomcatAPP
Using CATALINA_TMPDIR: /usr/local/tomcatAPP/temp
Using JRE_HOME: /usr/local/jdk1.8.0_121
Using CLASSPATH: /usr/local/tomcatAPP/bin/bootstrap.jar:/usr/local/tomcatAPP/bin/tomcat-juli.jar
Tomcat started.
# 啟動成功
[[email protected] tomcatAPP]# ps -ef |grep tomcatAPP
root 14689 1 0 11:14 pts/0 00:00:00 /bin/sh /usr/local/tomcatAPP/bin/catalina.sh start
root 14690 1 0 11:14 pts/0 00:00:00 /usr/local/sbin/cronolog /usr/local/tomcatAPP/logs/catalina.%Y-%m-%d.out
root 14691 14689 1 11:14 pts/0 00:02:21 /usr/local/jdk1.8.0_121/bin/java -Djava.util.logging.config.file=/usr/local/tomcatAPP/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms512m -Xmx1024m -Djdk.tls.ephemeralDHKeySize=2048 -Djava.endorsed.dirs=/usr/local/tomcatAPP/endorsed -classpath /usr/local/tomcatAPP/bin/bootstrap.jar:/usr/local/tomcatAPP/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcatAPP -Dcatalina.home=/usr/local/tomcatAPP -Djava.io.tmpdir=/usr/local/tomcatAPP/temp org.apache.catalina.startup.Bootstrap start
root 16017 14548 0 14:53 pts/0 00:00:00 grep tomcatAPP
我用的tomcat版本是7.0.70,目錄不存在具體是如何導致啟動失敗的暫時沒有搞清楚,希望有小夥伴留言一下。