最近在阿里雲服務器上裝tomcat,一開始為了省事直接使用了apt-get安裝,結果整個程序被拆開散到了好多地方,尤其是像網上說要把打包好了.war文件放到webapps文件夾下,但是開始並沒有在/usr的相關目錄下找到,即使后面找到了相關文件,但是等到運行/startup.sh的時候卻發現在日志文件里出現了下面的內容:
Dec 23, 2017 11:44:02 AM org.apache.catalina.startup.Catalina initDirs SEVERE: Cannot find specified temporary folder at /usr/share/tomcat8/temp Dec 23, 2017 11:44:02 AM org.apache.catalina.startup.Catalina load WARNING: Unable to load server configuration from [/usr/share/tomcat8/conf/server.xml] Dec 23, 2017 11:44:02 AM org.apache.catalina.startup.Catalina initDirs SEVERE: Cannot find specified temporary folder at /usr/share/tomcat8/temp Dec 23, 2017 11:44:02 AM org.apache.catalina.startup.Catalina load WARNING: Unable to load server configuration from [/usr/share/tomcat8/conf/server.xml] Dec 23, 2017 11:44:02 AM org.apache.catalina.startup.Catalina start SEVERE: Cannot start server. Server instance is not configured. Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.ClassLoaderFactory validateFile WARNING: Problem with directory [/usr/share/tomcat8/common/classes], exists: [false], isDirectory: [false], canRead: [false] Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.ClassLoaderFactory validateFile WARNING: Problem with directory [/usr/share/tomcat8/common], exists: [false], isDirectory: [false], canRead: [false] Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.ClassLoaderFactory validateFile WARNING: Problem with directory [/usr/share/tomcat8/server/classes], exists: [false], isDirectory: [false], canRead: [false] Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.ClassLoaderFactory validateFile WARNING: Problem with directory [/usr/share/tomcat8/server], exists: [false], isDirectory: [false], canRead: [false] Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.ClassLoaderFactory validateFile WARNING: Problem with directory [/usr/share/tomcat8/shared/classes], exists: [false], isDirectory: [false], canRead: [false] Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.ClassLoaderFactory validateFile WARNING: Problem with directory [/usr/share/tomcat8/shared], exists: [false], isDirectory: [false], canRead: [false] Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.Catalina initDirs SEVERE: Cannot find specified temporary folder at /usr/share/tomcat8/temp Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.Catalina load WARNING: Unable to load server configuration from [/usr/share/tomcat8/conf/server.xml] Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.Catalina initDirs SEVERE: Cannot find specified temporary folder at /usr/share/tomcat8/temp Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.Catalina load WARNING: Unable to load server configuration from [/usr/share/tomcat8/conf/server.xml] Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.Catalina start SEVERE: Cannot start server. Server instance is not configured.
摔,以第四行的server.xml找不到為例,因為apt-get的方法在下載的時候把server.xml放到了/etc/tomcat8里面而startup.sh則放到了/usr/share/tomcat8下,所以實際上根本就沒法正常運行,如果要運行就需要改很多地方,所以不如直接刪除后放棄,使用別的方式來的更快一些。
不過在這里還是給大家分享一下我找到的apt-get下載的東西都分布在哪里,這樣大家到時候如果要刪除的話也會更方便(可能不全歡迎大家幫忙補充):
/usr/share/tomcat8
etc/tomcat8 這里主要是一些配置文件(本來etc也是存放配置的)
var/lib/tomcat8/ 這里主要是存放webapps等文件
所以總的來說還是推薦大家去官網下載,也並不大,大概10MB左右,下載下來以后把它上傳到服務器上,然后找一個人地方解壓就好了,不過這個需要注意解決防火牆問題,輸入
/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
即可。
