10

I have a problem starting tomcat from terminal. I installed tomcat using - sudo apt-get install tomcat7, few days back. Now when I'm starting it using the below command, I'm getting the following error:

~/tomcat7/bin$ sudo ./startup.sh

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: 389: ./catalina.sh: cannot create /usr/share/tomcat7/logs/catalina.out: Directory nonexistent

I can't understand what went wrong. I was able to access - http://localhost:8080 when I installed it. But then, I ran the command to disable the startup at boot time:

sudo update-rc.d tomcat remove

And now it's not starting at all. :(

4 Answers4

6

When installed using the tomcat7 package, it is intended that you start and stop Tomcat using upstart (service tomcat start) or the /etc/init.d/tomcat script. If you start it using the startup.sh script then it is likely to have its environmental variables incorrectly configured.

Please see my answer to your previous question (How should I install Apache Tomcat 7 for use with Eclipse?) for a better way to install Tomcat if you don't want to run it as a service.

2

just create the missing folder like this:

sudo mkdir /var/tomcat/logs

then run tomcat again like this:

sudo sh /opt/apache-tomcat-{version}/bin/startup.sh

The message itself is self explanatory, if you don't know the hierarchy of the Unix/Linux File System, and how it works, i highly recommend you to start watching some tutorials.

1

I encountered the same problem, and I fixed it with the following:

sudo mkdir /usr/share/tomcat7/logs/
sudo touch /usr/share/tomcat7/logs/catalina.out
sudo chown -R tomcat: /usr/share/tomcat7/ 

Where "tomcat" is your Tomcat user

sudo systemctl daemon-reload
sudo systemctl start tomcat
David
  • 3,487
0

In my case I faced similar issue and tomcat7 would not start.
Apparently the /var/log/tomcat7 folder had been deleted due to box reboot...

Here is how i fixed :

rwxrwxrwx 1 root    root      17 Feb 27  2014 logs -> ../../log/tomcat7
/var/log# mkdir tomcat7
/var/log/tomcat7# cd /etc/init.d/
/etc/init.d# ./tomcat7 start
abu_bua
  • 11,313
dinbo
  • 1