I have an Ubuntu 16.04 fresh installation, where I have installed Tomcat7 using apt-get install
, and I'm having some problems trying to interact with the service using the service
command.
I understand that if Tomcat is installed on system, the correct way to interact with the service is using the service
command.
After a system reboot, I see that Tomcat7 is deploying a war application as expected, and everything looks to be working correctly in the web application.
But if I want to restart my Tomcat:
sudo service tomcat7 restart
I see in catalina.out
log that there are some errors caused by the address is already in use. There are any other application using the same port.
If I try to stop the tomcat, using as always service tomcat7 stop
:
usr@Srv2:~$ sudo service tomcat7 stop
[sudo] password for qgenviewer:
usr@Srv2:~$ ps -aux | grep tomcat7
tomcat7 1409 2.5 2.3 9268692 377788 ? Sl 12:11 0:27 /usr/lib/jvm/java-7-openjdk-amd64/bin/java -Djava.util.logging.config.file=/var/lib/tomcat7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Xms512m -Xmx6144m -XX:+UseConcMarkSweepGC -Djava.endorsed.dirs=/usr/share/tomcat7/endorsed -classpath /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar -Dcatalina.base=/var/lib/tomcat7 -Dcatalina.home=/usr/share/tomcat7 -Djava.io.tmpdir=/tmp/tomcat7-tomcat7-tmp org.apache.catalina.startup.Bootstrap start
usr+ 1762 0.0 0.0 21316 924 pts/0 S+ 12:29 0:00 grep -- color=auto tomcat7
So it looks like service
command is not working because Tomcat is still running. If I try service tomcat7 status
, the output is as follows:
usr@Srv2:~$ sudo service tomcat7 status
● tomcat7.service - LSB: Start Tomcat.
Loaded: loaded (/etc/init.d/tomcat7; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since vie 2016-05-06 12:11:29 CEST; 21min ago
Docs: man:systemd-sysv-generator(8)
Process: 1356 ExecStart=/etc/init.d/tomcat7 start (code=exited, status=1/FAILURE)
Tasks: 38 (limit: 512)
CGroup: /system.slice/tomcat7.service
└─1409 /usr/lib/jvm/java-7-openjdk-amd64/bin/java -Djava.util.logging.config.file=/var/lib/tomcat7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.C
may 06 12:11:24 Srv2 systemd[1]: Starting LSB: Start Tomcat....
may 06 12:11:24 Srv2 tomcat7[1356]: * Starting Tomcat servlet engine tomcat7
may 06 12:11:29 Srv2 tomcat7[1356]: ...fail!
may 06 12:11:29 Srv2 systemd[1]: tomcat7.service: Control process exited, code=exited status=1
may 06 12:11:29 Srv2 systemd[1]: Failed to start LSB: Start Tomcat..
may 06 12:11:29 Srv2 systemd[1]: tomcat7.service: Unit entered failed state.
may 06 12:11:29 Srv2 systemd[1]: tomcat7.service: Failed with result 'exit-code'.
may 06 12:28:38 Srv2 systemd[1]: Stopped LSB: Start Tomcat..
Any help of what is happening...? It finally looks like service tomcat7
is not working. What could be the cause?
Then, who is starting the tomcat service on system startup? And how I could stop or restart the tomcat7 service?
Thank you for your time.
Edit
In order to give more information, and following the advice of @Jens Grivolla, this is the output for pstree:
usr@Srv2:~$ pstree -lsup 1409
systemd(1)───java(1409,tomcat7)─┬─{java}(1412)
├─{java}(1418)
...
├─{java}(2262)
└─{java}(2313)