Ubuntu 14.04 server tomcat7 won't start on reboot
Solution 1
The problem is with your system variables.
You've CATALINA_HOME
defined, but there is no CATALINA_BASE
, therefore by default it's the same as CATALINA_HOME
, but it's not correct.
CATALINA_BASE
: (Optional) Base directory for resolving dynamic portions of a Catalina installation. If not present, resolves to the same directory that CATALINA_HOME points to.
Normally you should see something like:
# /usr/share/tomcat7/bin/catalina.sh run
Using CATALINA_BASE: /var/lib/tomcat7
Using CATALINA_HOME: /usr/share/tomcat7
Using CATALINA_TMPDIR: /tmp
Using JRE_HOME: /usr/lib/jvm/java-7-openjdk-amd64
Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
Using CATALINA_PID: /var/run/tomcat7.pid
If these variables are not present, either you may define them manually:
. /etc/default/tomcat7
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 CATALINA_HOME=/usr/share/tomcat7 CATALINA_BASE=/var/lib/tomcat7 CATALINA_PID=/var/run/tomcat7.pid CATALINA_TMPDIR=/tmp
/usr/share/tomcat7/bin/catalina.sh run
or configure your /etc/init.d/tomcat7
startup script correctly, as normally it should have these variables at the end:
# Directory where the Tomcat 6 binary distribution resides
CATALINA_HOME=/usr/share/$NAME
# Directory for per-instance configuration files and webapps
CATALINA_BASE=/var/lib/$NAME
Check content of catalina.sh
for more details, as it describes all Environment Variable Prerequisites.
Otherwise re-install your Tomcat.
Solution 2
Check this to see if it is related:
Tomcat7 installation failed via apt-get on Ubuntu 14.04
Basically, there is a dependency that may be missing (fixed with sudo apt-get install libtomcat7-java
), but assuming you already did this, it seems the apt-get package is generically FUBAR and requires post-install massaging (which typically I don't recommend as apt-get reconfigure
or other package commands may result in undesirable consequences).
Thus, installing the .tgz (from Apache) manually may be the most stable path of least resistance.
Related videos on Youtube
Winski Tech
Updated on September 18, 2022Comments
-
Winski Tech over 1 year
I have tomcat7 running on server for helpdesk ticketing system (SysAid). After a reboot the tomcat7 service does not start up.
In my catalina.out file when I grep for tomcat7 I get the following:
WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false] WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false] WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false] WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false] WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false] WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false] INFO: Deploying web application archive /var/lib/tomcat7/webapps/sysaid.war WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false] WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false] WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false] WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false] WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false] WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false] INFO: Deploying web application archive /var/lib/tomcat7/webapps/sysaid.war Initializing log4j with: /var/lib/tomcat7/webapps/sysaid/./WEB-INF/log4j.properties Initializing log4j with: /var/lib/tomcat7/webapps/sysaid/./WEB-INF/log4j.properties INFO: Deploying web application directory /var/lib/tomcat7/webapps/ROOT
The help desk program log files show no mention of tomcat7 errors.
When I run a startup script for the program I get the following:
Using CATALINA_BASE: /usr/share/tomcat7 Using CATALINA_HOME: /usr/share/tomcat7 Using CATALINA_TMPDIR: /usr/share/tomcat7/temp Using JRE_HOME: /usr Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar touch: cannot touch ‘/usr/share/tomcat7/logs/catalina.out’: No such file or directory ./catalina.sh: 385: ./catalina.sh: cannot create /usr/share/tomcat7/logs/catalina.out: Directory nonexistent
I also checked to make sure it was already set to run at startup through rc.d with the command:
sudo update-rc.d tomcat7 defaults
Here's what I get:
System start/stop links for /etc/init.d/tomcat7 already exist.
I've removed it and re-added it, with no change. Can someone help me? Thanks in advance.
-
Winski Tech about 9 yearsHere's my results:
libtomcat7-java is already the newest version. libtomcat7-java set to manually installed.
So it looks like it's already updated. I guess I'll try the .tgz install manually. -
Winski Tech about 9 yearsA complete reinstall of the program did not work. I additionally flushed out the logs and let the program recreate them, this did not help.
-
Andrew about 9 yearsNot entirely surprising. Did you look in any logs and more importantly, are the log errors different this time? For instance, instead of missing files/directories, this time it might be apparmor or some other issue that might not have occurred using a proper debian package.