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:
CATALINA_HOME=/usr/local/tomcat9
JAVA_HOME=/usr/lib/jvm/jdk1.8.0_111
3) use command
service tomcat start
2. setup a service in systemd
1) edit file "/etc/systemd/system/tomcat.service"
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"
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
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.
Environment="CATALINA_HOME=/usr/local/tomcat9"
instead ofEnvironment=CATALINA_HOME=/usr/local/tomcat9