Permissions for tomcat 8 service file not working
Solution 1
Simply delete everything you have done so far. Then:
sudo apt-get install tomcat8
sudo service tomcat8 start
Solution 2
You have to exec
cd /opt/tomcat/bin && sudo chmod +x catalina.sh
Tomcat needs to start catalina.sh from startup.sh
Solution 3
The best way to find the answer is to change your tomcat-user to be able to login and see what happens when the "startup.sh" is being run. Simply change /etc/passwd like this (notice a bash-shell as the last column):
tomcat:x:1001:1001::/home/tomcat:/bin/bash
Then login by running
sudo su - tomcat
Then run the
./startup.sh
It will display the real reason why the command failed.
Related videos on Youtube
user3203425
Updated on September 18, 2022Comments
-
user3203425 over 1 year
I'm trying to install tomcat 8 on ubuntu 16.04. This is the guide I'm following:
https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-16-04
The basic idea is that you're supposed to create an additional user named "tomcat" with limited rights to run tomcat. When I try to run the final command to start as a service (tried it as root):
sudo systemctl start tomcat
I get the following error:
Job for tomcat.service failed because the control process exited with error code. See "systemctl status tomcat.service" and "journalctl -xe" for details.
Checking systemctl status:
tomcat.service - Apache Tomcat Web Application Container Loaded: loaded (/etc/systemd/system/tomcat.service; disabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) Process: 14 ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=203/EXEC) systemd[1]: Starting Apache Tomcat Web Application Container... systemd[1]: tomcat.service: Control process exited, code=exited status=203 systemd[1]: Failed to start Apache Tomcat Web Application Container. systemd[1]: tomcat.service: Unit entered failed state. systemd[1]: tomcat.service: Failed with result 'exit-code'.
This is the tomcat.service file:
# /etc/systemd/system/tomcat.service [Unit] Description=Apache Tomcat Web Application Container After=network.target [Service] Type=forking Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64 Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid Environment=CATALINA_HOME=/opt/tomcat Environment=CATALINA_BASE=/opt/tomcat Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC' Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom' ExecStart=/opt/tomcat/bin/startup.sh ExecStop=/opt/tomcat/bin/shutdown.sh User=tomcat Group=tomcat RestartSec=10 Restart=always [Install] WantedBy=multi-user.target
These are the access rights on the /tomcat/bin folder:
-rwxr-x--- 1 root root 1902 Jul 6 08:44 shutdown.sh -rwxr-x--- 1 root root 1904 Jul 6 08:44 startup.sh ...
Other users are reporting the same problem, and suggest giving the "tomcat" user ownership of the entire "tomcat" folder. But that seems to conflict with the spirit of the article (limiting access to improve security).
I'm not sure if I'm missing something implied in the article here regarding permissions?
Thanks
-
yass about 7 yearsCan you give more details?
-
Lisandro about 7 yearsapt-get is the package manager for ubuntu. The first command installs ubuntu, the second command starts it. The error the OP was getting is based on trying to install Tomcat manually.
-
Zina about 6 yearsNice touch downvoting it without an explanation. Would really like to know why. As stated in my answer I followed the same procedure the OP did. Got the same error. So the downvote should really go to that article :) And told him how he should have installed it :)
-
Worthwelle over 5 yearsAdding more context to this answer by editing it, would make this much more useful to anyone who may come across this in the future.