Service tomcat8 failed to start by using service t

2019-03-27 17:13发布

问题:

I'm using Vagrant to deploy to Ubuntu Linux and try to start a tomcat8 service.

Tomcat 8 was installed by apt-get install tomcat8.

When using the service tomcat8 start command, I got the following error:

Job for tomcat8.service failed. See "systemctl status tomcat8.service" and "journalctl -xe" for details.

Then I tracked the systemctl status tomcat8.service, found that:


? tomcat8.service - LSB: Start Tomcat. Loaded: loaded (/etc/init.d/tomcat8)
Active: failed (Result: exit-code) since Mon 2016-03-28 09:44:17 GMT; 5s ago
Docs: man:systemd-sysv-generator(8)
Process: 884 ExecStop=/etc/init.d/tomcat8 stop (code=exited, status=0/SUCCESS)
Process: 1312 ExecStart=/etc/init.d/tomcat8 start (code=exited, status=1/FAILURE)
Mar 28 09:44:12 vagrant-ubuntu-trusty systemd[1]: Starting LSB: Start Tomcat....
Mar 28 09:44:12 vagrant-ubuntu-trusty tomcat8[1312]: * Starting Tomcat servlet engine tomcat8
Mar 28 09:44:17 vagrant-ubuntu-trusty tomcat8[1312]: ...fail!
Mar 28 09:44:17 vagrant-ubuntu-trusty systemd[1]: tomcat8.service: control process exited, code=exited status=1
Mar 28 09:44:17 vagrant-ubuntu-trusty systemd[1]: Failed to start LSB: Start Tomcat..
Mar 28 09:44:17 vagrant-ubuntu-trusty systemd[1]: Unit tomcat8.service entered failed state.
Mar 28 09:44:17 vagrant-ubuntu-trusty systemd[1]: tomcat8.service failed.

I'm unsure of how to proceed to get my Tomcat 8 service running.

回答1:

This could be related to this bug. Recent versions of Java deprecate the use of endorsed directories and fail if one is specified, but Tomcat8 specifies one even if it doesn't exist. Check the log in /var/log/tomcat8/ as suggested in the comments to your question to see whether this is indeed the source of your problem. If it is, you can either wait for the bug to be fixed or try the updated catalina.sh file suggested in the linked bug report.



回答2:

What I did to solve the issue :

Process: 1312 ExecStart=/etc/init.d/tomcat8 start (code=exited, status=1/FAILURE)

See tomcat's dependencies
dpkg -s tomcat8-common|grep Depends

and the system java version
javar -version

And try to sort out things with the appropriate java version if things don't match.


If that's not the case, continue :

Never bad to start with
sudo apt-get update

Check eventual running tomcat processes
ps aux | grep java

Test the pid you're going to kill
pgrep -f tomcat

Targeted action
sudo pkill -f tomcat

Start removing by typing sudo apt-get remove tomcat8-tab.
You might find :

tomcat8-common tomcat8-user

Complete remove with ( I don't know which of these below is the most appropriate to run )
sudo apt-get purge tomcat8 or
sudo apt-get --auto-remove purge tomcat8 or just
sudo apt-get remove tomcat8

You can also
sudo apt-get autoremove

Carefully sudo rm -r folders like

  • /var/lib/tomcat*
  • /usr/share/tomcat*
  • /etc/tomcat*

Reboot
sudo systemctl reboot

When back on track install
sudo apt-get install tomcat8

Check how's going
sudo systemctl status tomcat8.service
sudo /usr/share/tomcat8/bin/version.sh

Better ?