0

I had that working some time ago. Now, I found out that I had uninstalled tomcat7, thus I installed it again, following the very same (my) procedure I had followed back then:

How to install Strabon for Linux

So, when I access http://localhost:8080/ I am getting a 404, like this:

HTTP Status 404 - /

type Status report

message /

description The requested resource is not available.
Apache Tomcat/7.0.52 (Ubuntu)

but when I access http://localhost:8080/strabonendpoint/, everything works fine! What is going on? I want to access http://localhost:8080/ in my browser and get the message "It works!".


The port listeners:

gsamaras@gsamaras:~$ netstat -t | grep 8080
gsamaras@gsamaras:~$ 

My /etc/tomcat7/server.xml:

<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           URIEncoding="UTF-8"
           redirectPort="8443" />

My webapps:

gsamaras@gsamaras:/var/lib/tomcat7/webapps$ ls
ROOT  strabonendpoint  strabonendpoint.war
gsamaras@gsamaras:/var/lib/tomcat7/webapps/ROOT$ ls
strabonendpoint-temp
gsamaras@gsamaras:/var/lib/tomcat7/webapps/ROOT$ cd strabonendpoint-temp/
gsamaras@gsamaras:/var/lib/tomcat7/webapps/ROOT/strabonendpoint-temp$ ls
fnehnd4mdc3vvr93fdt227p886.kml

Is tomcat listening on port 8080?

gsamaras@gsamaras:/var/lib/tomcat7/webapps$ sudo netstat -tlnp |grep java
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      6841/java       
tcp6       0      0 :::8080                 :::*                    LISTEN      6841/java  

The beginning of /var/lib/tomcat7/logs/catalina.out:

Mar 13, 2016 6:23:05 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
Mar 13, 2016 6:23:05 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
Mar 13, 2016 6:23:05 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
Mar 13, 2016 6:23:05 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]
Mar 13, 2016 6:23:05 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
Mar 13, 2016 6:23:05 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]
Mar 13, 2016 6:23:05 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Mar 13, 2016 6:23:05 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 717 ms
Mar 13, 2016 6:23:05 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 13, 2016 6:23:05 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.52 (Ubuntu)
Mar 13, 2016 6:23:06 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/tomcat7/webapps/strabonendpoint.war
2016-03-13 18:23:11,029 [localhost-startStop-1] WARN  eu.earthobservatory.org.StrabonEndpoint.StrabonBeanWrapper  - [StrabonEndpoint] Strabon n$
2016-03-13 18:23:11,030 [localhost-startStop-1] WARN  eu.earthobservatory.org.StrabonEndpoint.StrabonBeanWrapper  - [StrabonEndpoint] Initializ$
2016-03-13 18:23:11,036 [localhost-startStop-1] INFO  eu.earthobservatory.runtime.postgis.Strabon  - [Strabon] Cleaning...
2016-03-13 18:23:11,114 [localhost-startStop-1] INFO  eu.earthobservatory.runtime.postgis.Strabon  - [Strabon] Clearing Successful.
2016-03-13 18:23:12,248 [localhost-startStop-1] INFO  eu.earthobservatory.runtime.postgis.Strabon  - [Strabon] Initialization completed.
2016-03-13 18:23:12,250 [localhost-startStop-1] INFO  eu.earthobservatory.runtime.generaldb.Strabon  - [Strabon] Initialization took 1134 ms.
Mar 13, 2016 6:23:14 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /var/lib/tomcat7/webapps/ROOT
Mar 13, 2016 6:23:14 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
2016-03-13 18:23:14,964 [Thread-2] INFO  eu.earthobservatory.runtime.generaldb.Strabon  - [Strabon.close] Closing connection...
java.lang.IllegalStateException: Shutdown in progress
        at java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:66)
        at java.lang.Runtime.addShutdownHook(Runtime.java:211)
       at org.apache.catalina.startup.Catalina.start(Catalina.java:710)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
2016-03-13 18:23:15,004 [Thread-2] INFO  eu.earthobservatory.runtime.postgis.Strabon  - [Strabon] Cleaning...
2016-03-13 18:23:15,010 [Thread-2] INFO  eu.earthobservatory.runtime.postgis.Strabon  - [Strabon] Clearing Successful.
2016-03-13 18:23:15,011 [Thread-2] INFO  eu.earthobservatory.runtime.generaldb.Strabon  - [Strabon.close] Connection closed.

The first line of localhost_access_log.2016-03-13.txt:

127.0.0.1 - - [13/Mar/2016:18:23:26 +0200] "GET / HTTP/1.1" 404 969
gsamaras
  • 71,951
  • 46
  • 188
  • 305
  • this should help: http://stackoverflow.com/questions/5328518/deploying-my-application-at-the-root-in-tomcat – Dusan Bajic Mar 13 '16 at 16:44
  • @dusan.bajic the .war application (i.e. Strabon) is working fine, I am not sure how your link helps me. :/ – gsamaras Mar 13 '16 at 16:46

1 Answers1

3

The contents of your ROOT folder is why it's not working, why strabon put that temp file and kml file in there I can't say. If you put an "index.html" (I think) file in the ROOT folder and make it's contents "It Works!" You'll be able to see what I mean.

(second alternative) Go into your web apps folder. Rename the application folder to ROOT, then restart tomcat and you'll be able to access it at the initial Url you mentioned.

Aslan Brooke
  • 497
  • 2
  • 8
  • The problem is not Strabon. Check my edit for the `webapps` folder. The problem is that localhost:8080 is not working. I do not want to chnage something wrt Strabon. – gsamaras Mar 13 '16 at 16:59
  • Time to look in the logs under the logs/ folder in tomcat. – nos Mar 13 '16 at 17:03
  • What's the desired affect? Do you want "/" to redirect to Strabon? – Aslan Brooke Mar 13 '16 at 17:05
  • @nos where is that? I am only able to do this `less /proc/$(pgrep -f tomcat)/fd/1` for now. @Aslan, I want to access http://localhost:8080/ in my browser and get the message "It works!". – gsamaras Mar 13 '16 at 17:06
  • It's in your tomcat installation folder, at the same level as the webapps, conf, bin folder there should be a logs folder. – nos Mar 13 '16 at 17:07
  • What is in your ROOT folder? Is there an index.html file or something like that? – Aslan Brooke Mar 13 '16 at 17:09
  • The contents of your ROOT folder is why it's not working, why strabon put that temp file and kml file in there I can't say. If you put an "index.html" (I think) file in the ROOT folder and make it's contents "It Works!" You'll be able to see what I mean. – Aslan Brooke Mar 13 '16 at 17:33
  • Correct, can you please update your answer with that? :) – gsamaras Mar 13 '16 at 17:40
  • Great I added that last comment to the answer, if this helps you solve it please mark the answer correct accordingly. – Aslan Brooke Mar 13 '16 at 17:41
  • Of course @AslanBrooke, I will also upvote you, since I couldn't think of that by myself! ;) – gsamaras Mar 13 '16 at 17:46