This post details some issues encountered when installing Tomcat web server from package onto Ubuntu 16.04.
When running the standard
sudo apt-get install tomcat7 command, Tomcat is downloaded and unpackaged however it fails to complete the install and produces this error:
Setting up tomcat7 (7.0.26-1ubuntu1.1) ... chmod: cannot access `/etc/tomcat7/tomcat-users.xml': No such file or directory dpkg: error processing tomcat7 (--configure): subprocess installed post-installation script returned error exit status 1 No apport report written because MaxReports is reached already >Errors were encountered while processing: tomcat7 E: Sub-process /usr/bin/dpkg returned an error code (1)
This is caused by improper permissions group assignment of the Tomcat config file. To resolve this I simply removed the file
sudo rm /etc/tomcat7/tomcat-users.xml and then re-ran the installation again.
I thought I was out of the woods but then after re-installing I got a new error with exit status 1. After checking the
journalctl I discovered that Tomcat could not find the default locations for Java and was searching for OpenJava other locations.
Which was strange because JAVA_HOME was set on my environment but not in my bash config. The solution as was identified on StackOverflow is the following.
gksudo gedit /etc/default/tomcat7
Inside the editor look for the commented out line for JAVA_HOME, then specify it to your Oracle Java location which is normally
After saving this change and restarting Tomcat, you should be cooking with gas!