2016-03-29 93 views
0

我有一個servlet應用程序,我試圖部署到我的本地tomcat實例。起初我嘗試使用Tomcat管理器應用程序部署,但被告知有一個更簡單的方法 - 只需在webapps -folder丟棄.war/etc/tomcat8/webapps/我的機器上)在tomcat8啓動.war servlet

在重新啓動Tomcat服務,但是我得到一個錯誤:

Job for tomcat8.service failed because the control process exited with error code. See "systemctl status tomcat8.service" and "journalctl -xe" for details. 

journalctl -xe輸出如下:

...... 
session opened for user root by martini(uid=0) 
mar 29 14:23:17 martini-XPS-13-9350 polkitd(authority=local)[737]: Registered Authentication Agent for unix-process:9719:7772642 (system bus name :1.160 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) 
mar 29 14:23:17 martini-XPS-13-9350 systemd[1]: Stopped LSB: Start Tomcat.. 
-- Subject: Unit tomcat8.service has finished shutting down 
-- Defined-By: systemd 
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel 
-- 
-- Unit tomcat8.service has finished shutting down. 
mar 29 14:23:17 martini-XPS-13-9350 systemd[1]: Starting LSB: Start Tomcat.... 
-- Subject: Unit tomcat8.service has begun start-up 
-- Defined-By: systemd 
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel 
-- 
-- Unit tomcat8.service has begun starting up. 
mar 29 14:23:17 martini-XPS-13-9350 tomcat8[9728]: * Starting Tomcat servlet engine tomcat8 
mar 29 14:23:22 martini-XPS-13-9350 tomcat8[9728]: ...fail! 
mar 29 14:23:22 martini-XPS-13-9350 systemd[1]: tomcat8.service: Control process exited, code=exited status=1 
mar 29 14:23:22 martini-XPS-13-9350 systemd[1]: Failed to start LSB: Start Tomcat.. 
-- Subject: Unit tomcat8.service has failed 
-- Defined-By: systemd 
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel 
-- 
-- Unit tomcat8.service has failed. 
-- 
-- The result is failed. 
mar 29 14:23:22 martini-XPS-13-9350 systemd[1]: tomcat8.service: Unit entered failed state. 
mar 29 14:23:22 martini-XPS-13-9350 systemd[1]: tomcat8.service: Failed with result 'exit-code'. 
mar 29 14:23:22 martini-XPS-13-9350 polkitd(authority=local)[737]: Unregistered Authentication Agent for unix-process:9719:7772642 (system bus name :1.160, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus) 
mar 29 14:23:22 martini-XPS-13-9350 sudo[9718]: pam_unix(sudo:session): session closed for user root 

我懷疑這是在我的本地環境(這是新安裝的)的配置錯誤,但無法弄清楚究竟是什麼 有可能!我嘗試重新安裝,但過了一段時間,我又一次陷入了同樣的死衚衕......任何想法?

編輯:這裏是來自systemctl status tomcat8.service輸出:

➜ ~ systemctl status tomcat8.service 
● tomcat8.service - LSB: Start Tomcat. 
    Loaded: loaded (/etc/init.d/tomcat8) 
    Active: failed (Result: exit-code) since tis 2016-03-29 17:05:45 CEST; 14s ago 
    Docs: man:systemd-sysv-generator(8) 
    Process: 3724 ExecStart=/etc/init.d/tomcat8 start (code=exited, status=1/FAILURE) 

mar 29 17:05:40 martini-XPS-13-9350 systemd[1]: Stopped LSB: Start Tomcat.. 
mar 29 17:05:40 martini-XPS-13-9350 systemd[1]: Starting LSB: Start Tomcat.... 
mar 29 17:05:40 martini-XPS-13-9350 tomcat8[3724]: * Starting Tomcat servlet engine tomcat8 
mar 29 17:05:45 martini-XPS-13-9350 tomcat8[3724]: ...fail! 
mar 29 17:05:45 martini-XPS-13-9350 systemd[1]: tomcat8.service: Control process exited, code=exited status=1 
mar 29 17:05:45 martini-XPS-13-9350 systemd[1]: Failed to start LSB: Start Tomcat.. 
mar 29 17:05:45 martini-XPS-13-9350 systemd[1]: tomcat8.service: Unit entered failed state. 
mar 29 17:05:45 martini-XPS-13-9350 systemd[1]: tomcat8.service: Failed with result 'exit-code'. 
➜ ~ 
+0

開始的幾件事:1.如果沒有webapps中的新war文件,tomcat會啓動嗎? 2.您是否檢查了tomcat,Catalina.log和localhost日誌文件中'logs'目錄中的tomcat日誌。 –

+0

catalina.log舉行答案!以前不知道這個! –

回答

1

我發現端輸出,以有些誤導這裏。顯然有一個名爲Catalina.log的日誌文件(在Ubuntu上默認爲/var/lib/tomcat8/conf/catalina.log)。這是我發現麻煩的真正原因。顯然在我的server.xml配置中有一個問題(文件丟失)。

這裏更廣泛的一課是 - 檢查你的catalina.log何時遇到了tomcat的麻煩!