I installed tomcat9 on ubuntu 16.04, which start normally on command line,

sudo /usr/local/tomcat9/startup.sh

and all projects in webapps can be loaded.

However, it always hangs on loading "webapps/docs" if i try to start it on OS boot. Here's the snapshot of catalina.out:


I've tried 3 kinds of methods to auto-start tomcat.

1. setup a service in diretory init.d

1) Copy file "catalina.sh" into "/etc/init.d", and rename it to "tomcat" 2) add Evirement Virables to this file:


3) use command

  service tomcat start

2. setup a service in systemd

1) edit file "/etc/systemd/system/tomcat.service" enter image description here

2) load configuration in command line

   systemctl daemon-reload
   systemctl start tomat

3) check status

   systemctl status tomat

which shows tomcat service start successfully

3. Setup "rc.local" service first, and add start script in "rc.local" file

1) edit file "/etc/systemd/system/rc-local.servic"

Description=/etc/rc.local Compatibility

ExecStart=/etc/rc.local start


2) edit file "/etc/rc.local "

  sudo /usr/local/tomcat9/bin/startup.sh

3) enable "rc.local" service

  sudo systemctl enable rc-local.service

4) reboot

All these methods gave the same result: tomcat started, but loading webapps imcomplete, hanging on loading the first app "docs".

I have no idea on it, please help.


Similar behavior I once had, when on startup a different JAVA_HOME system environment variable was set.
The suspect line is this: suspect line

This looks like a different java than th one you mentioned with JAVA_HOME=/usr/lib/jvm/jdk1.8.0_111.

I would try something like this:

  1. check your default java with update-alternatives --config java
  2. check if somewhere a JAVA_PATH is set

Further you mentioned you copied catalina.sh to /etc/init.d. This could be also a problem. In our environments (actually tomcat7, but I think it is quite similar) we have a simple script in /etc/init.d which set JAVA_HOME an start startup.sh. It looks something like that:

export JAVA_HOME
export JRE_HOME

export PATH

case $1 in
sh $CATALINA_HOME/bin/startup.sh
sh $CATALINA_HOME/bin/shutdown.sh -force
sh $CATALINA_HOME/bin/shutdown.sh -force
sleep 3
sh $CATALINA_HOME/bin/startup.sh

Perhaps you should consider to start startup.sh with your /etc/init.d script.

I hope gave you some input to investigate your problem further.


One way to start the tomcat on the startup is to run it using cron using the @reboot attribute:

open up a terminal and type :

sudo crontab -e

at the end of the file enter the command:

@reboot PATH_TO_WHERE_TOMCAT_INSTALLED/bin/startup.sh

save the file and exit.

The above command will run the command once everytime computer boots up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.