0

I am trying to install apache-tomcat-9.0.33 on a 64 bit machine running Ubuntu 18.04.4 LTS. I followed the script given on https://linuxize.com/post/how-to-install-tomcat-9-on-ubuntu-18-04/. Everything went well until near the end of step 4. When I tried to start tomcat I got the following:

~$ sudo systemctl start tomcat
Job for tomcat.service failed because the control process exited with error code.
See "systemctl status tomcat.service" and "journalctl -xe" for details.

The output from these commands suggested to me that the problem was caused by incorrect permissions.

I executed all of the suggestions in the following:

Unable to start Apache Tomcat 8.5.4 on Ubuntu 16.04

Now the permissions for every .sh file in /opt/tomcat/bin/ are set to "-rwxr-xr-x" and every file in that directory has "tomcat" as owner and as group. Further, every directory in the path /opt/tomcat/bin/ has permissions "drwxr-xr-x" and "tomcat" as owner and as group.

I checked that the value for JAVA_HOME given in /etc/systemd/system/tomcat.service is the same as given by printenv JAVA_HOME.

Start still failed.

I rebooted the machine, checked that there was no stale pid, tried again, and start failed:

~$ ps ax | grep tomcat
 4795 tty2     Sl+    0:16 gedit /home/coffeepot/Desktop/tomcat fail 1.txt
 5379 pts/0    S+     0:00 grep --color=auto tomcat

~$ sudo systemctl start tomcat
Job for tomcat.service failed because the control process exited with error code.
See "systemctl status tomcat.service" and "journalctl -xe" for details.

sudo systemctl status tomcat
● tomcat.service - Apache Tomcat Web Application Container
   Loaded: loaded (/etc/systemd/system/tomcat.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2020-04-21 09:58:12 EDT; 15s ago
  Process: 5233 ExecStart=/opt/tomcat/latest/bin/startup.sh (code=exited, status=0/SUCCESS)
 Main PID: 5243 (code=exited, status=2)

Apr 21 09:58:12 m11 systemd[1]: Starting Apache Tomcat Web Application Container...
Apr 21 09:58:12 m11 startup.sh[5233]: Existing PID file found during start.
Apr 21 09:58:12 m11 startup.sh[5233]: Removing/clearing stale PID file.
Apr 21 09:58:12 m11 startup.sh[5233]: Tomcat started.
Apr 21 09:58:12 m11 systemd[1]: Started Apache Tomcat Web Application Container.
Apr 21 09:58:12 m11 systemd[1]: tomcat.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Apr 21 09:58:12 m11 systemd[1]: tomcat.service: Failed with result 'exit-code'.

journalctl -xe
-- 
-- The result is RESULT.
Apr 21 09:58:11 m11 systemd[1]: Dependency failed for /mnt/28db1409-5a51-40d2-84ad-3b4496c805ec.
-- Subject: Unit mnt-28db1409\x2d5a51\x2d40d2\x2d84ad\x2d3b4496c805ec.mount has failed
-- Defined-By: systemd
-- Support: 
-- 
-- Unit mnt-28db1409\x2d5a51\x2d40d2\x2d84ad\x2d3b4496c805ec.mount has failed.
-- 
-- The result is RESULT.
Apr 21 09:58:11 m11 systemd[1]: mnt-28db1409\x2d5a51\x2d40d2\x2d84ad\x2d3b4496c805ec.mount: Job mnt-28db1409\x2d5a51\x2d40d2\x2d84ad\x2d3b4496c805ec.mount/start failed with result 'dependency'.
Apr 21 09:58:11 m11 systemd[1]: dev-disk-by\x2duuid-28db1409\x2d5a51\x2d40d2\x2d84ad\x2d3b4496c805ec.device: Job dev-disk-by\x2duuid-28db1409\x2d5a51\x2d40d2\x2d84ad\x2d3b4496c805ec.device/start failed with
Apr 21 09:58:12 m11 sudo[5230]: coffeepot : TTY=pts/0 ; PWD=/home/coffeepot ; USER=root ; COMMAND=/bin/systemctl start tomcat
Apr 21 09:58:12 m11 sudo[5230]: pam_unix(sudo:session): session opened for user root by (uid=0)
Apr 21 09:58:12 m11 systemd[1]: Starting Apache Tomcat Web Application Container...
-- Subject: Unit tomcat.service has begun start-up
-- Defined-By: systemd
-- Support: 
-- 
-- Unit tomcat.service has begun starting up.
Apr 21 09:58:12 m11 startup.sh[5233]: Existing PID file found during start.
Apr 21 09:58:12 m11 startup.sh[5233]: Removing/clearing stale PID file.
Apr 21 09:58:12 m11 startup.sh[5233]: Tomcat started.
Apr 21 09:58:12 m11 systemd[1]: Started Apache Tomcat Web Application Container.
-- Subject: Unit tomcat.service has finished start-up
-- Defined-By: systemd
-- Support: 
-- 
-- Unit tomcat.service has finished starting up.
-- 
-- The start-up result is RESULT.
Apr 21 09:58:12 m11 systemd[1]: tomcat.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Apr 21 09:58:12 m11 systemd[1]: tomcat.service: Failed with result 'exit-code'.
Apr 21 09:58:12 m11 sudo[5230]: pam_unix(sudo:session): session closed for user root
Apr 21 09:58:17 m11 gnome-shell[4476]: Ignoring excess values in shadow definition
Apr 21 09:58:17 m11 gnome-shell[4476]: Ignoring excess values in shadow definition
Apr 21 09:58:17 m11 gnome-shell[4476]: Ignoring excess values in shadow definition
Apr 21 09:58:17 m11 gnome-shell[4476]: Ignoring excess values in shadow definition
Apr 21 09:58:18 m11 gnome-shell[4476]: Ignoring excess values in shadow definition
Apr 21 09:58:18 m11 gnome-shell[4476]: Ignoring excess values in shadow definition
Apr 21 09:58:19 m11 gnome-shell[4476]: Ignoring excess values in shadow definition
Apr 21 09:58:19 m11 gnome-shell[4476]: Ignoring excess values in shadow definition
Apr 21 09:58:19 m11 gnome-shell[4476]: Ignoring excess values in shadow definition
Apr 21 09:58:19 m11 gnome-shell[4476]: Ignoring excess values in shadow definition
Apr 21 09:58:19 m11 gnome-shell[4476]: Ignoring excess values in shadow definition
Apr 21 09:58:19 m11 gnome-shell[4476]: Ignoring excess values in shadow definition
Apr 21 09:58:28 m11 sudo[5245]: coffeepot : TTY=pts/0 ; PWD=/home/coffeepot ; USER=root ; COMMAND=/bin/systemctl status tomcat
Apr 21 09:58:28 m11 sudo[5245]: pam_unix(sudo:session): session opened for user root by (uid=0)
Apr 21 09:58:28 m11 sudo[5245]: pam_unix(sudo:session): session closed for user root
Apr 21 09:58:43 m11 gnome-shell[4476]: Ignoring excess values in shadow definition
Apr 21 09:58:43 m11 gnome-shell[4476]: Ignoring excess values in shadow definition
Apr 21 09:58:43 m11 gnome-shell[4476]: Ignoring excess values in shadow definition
Apr 21 09:58:43 m11 gnome-shell[4476]: Ignoring excess values in shadow definition
Apr 21 09:58:48 m11 PackageKit[1334]: get-updates transaction /1028_ecebadde from uid 1000 finished with success after 398ms

What am I missing? How can I get tomcat to work?

1 Answers1

0

I found the cause of the problem. When I took a closer look at the Catalina log I found that I had added an extra slash to the path in JAVA_HOME, causing Tomcat to be unable to locate Java.