5

So I've followed the list of steps on : https://www.digitalocean.com/community/articles/how-to-install-apache-tomcat-on-ubuntu-12-04.

When I try to run the startup script, I get this message:

$CATALINA_HOME/bin/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/lib/jvm/default-java
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
/usr/share/tomcat7/bin/catalina.sh: 389: /usr/share/tomcat7/bin/catalina.sh: cannot create /usr/share/tomcat7/logs/catalina.out: Directory nonexistent

What am I supposed to do to fix this? And am I supposed to modify the CATALINA_BASE variable?

Braiam
  • 67,791
  • 32
  • 179
  • 269

2 Answers2

3

Your problem is that you cannot mix guides. Just revert the modifications to the ~/.bashrc file. With the first command you already have tomcat installed but without starting the webserver. Just run sudo service tomcat7 start then go to your web browser and type http://localhost:8080 and done.

enter image description here

sudo lsof -i:8080
COMMAND   PID    USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    11399 tomcat7   44u  IPv6 632616      0t0  TCP *:http-alt (LISTEN)
Braiam
  • 67,791
  • 32
  • 179
  • 269
  • I undid my changes and ran the start command and got: * Starting Tomcat servlet engine tomcat7 [ OK ] – sportsfan72 Sep 25 '13 at 21:01
  • When I type ps -ef | grep java | grep 8080, I don't get anything. And it's running on a server, so when I try servername:8080 I get "This webpage is not avaiable". – sportsfan72 Sep 25 '13 at 21:03
  • And as for mixing guides, I only followed one with 4 steps, not sure why it wouldn't work. – sportsfan72 Sep 25 '13 at 21:06
  • Use sudo lsof -i:8080. See my updated answer. – Braiam Sep 25 '13 at 21:09
  • I get the same results as you for the most part. I'm assuming that it means tomcat is indeed running. This is running on a server, and I attempt to access it using 'servername:8080', but I get "This webpage is not available" Any suggestions? – sportsfan72 Sep 25 '13 at 21:15
  • Tomcat is only available to local users. If you are in a SSH session install lynx then use lynx localhost:8080 and you will see your server working. – Braiam Sep 25 '13 at 21:26
  • I've installed lynx, and now I tried that command, I get "Network Access Message: The page cannot be displayed". – sportsfan72 Sep 25 '13 at 21:35
  • I don't have the slightless idea of what is happening then. In my system (Ubuntu 13.04) works just fine. I would remove all the installation sudo apt-get --purge autoremove tomcat7* and install again. – Braiam Sep 25 '13 at 21:38
  • removed it and re-installed it, same thing happens. am I supposed to be in a certain directory when performing lynx localhost:8080? – sportsfan72 Sep 25 '13 at 21:45
  • No, as I said it should "just work". You either have installed a firewall restricting the localhost, or another oddity. – Braiam Sep 25 '13 at 21:51
  • Would I be able to work around that firewall(I have not set up this server)? – sportsfan72 Sep 25 '13 at 21:53
  • Your server is up and listening (if your lsof is the same as mine). Another thing I would try is using lynx 127.0.0.1:8080 instead. – Braiam Sep 25 '13 at 21:57
  • Same result as before. – sportsfan72 Sep 25 '13 at 21:59
  • Most likeley your firewall is iptables, so run sudo iptables-save and post results so we can see if it's blocking the connection – Samuel Peter Sep 25 '13 at 22:14
  • @SamuelPeter I'm looking at the results, is there anything specific I should be looking for? – sportsfan72 Sep 25 '13 at 22:20
  • Edit your question and add them. – Braiam Sep 25 '13 at 22:24
  • If connections through loopback interface were allowed you would have something like -A INPUT -i lo -j ACCEPT, or if port 8080 was accessible from everywhere you would have -A INPUT -p tcp --dport 8080 -j ACCEPT. This applies only if the default action is to drop ie you have -A INPUT -j DROP as a last rule. Easiest would be for you to copy paste the whole thing – Samuel Peter Sep 25 '13 at 22:30
  • "Easiest would be for you to copy paste the whole thing"... what are you waiting for!? Just copy the whole thing, hit "edit" in your question and dump it there. – Braiam Sep 25 '13 at 22:32
  • You can have a look at https://help.ubuntu.com/community/IptablesHowTo to understand – Samuel Peter Sep 25 '13 at 22:35
0

You will need to create logs folder and catalina.out file under the folder that it is complaining for 'no such file or directory' and give chmod 766 catalina.out. After that run $CATALINA_HOME/bin/startup.sh again.