当tomcat7 localhost:8080无法正常工作时该怎么办?

时间:2016-03-13 16:37:56

标签: linux tomcat ubuntu localhost port

我前段时间工作了。现在,我发现我已经卸载了 tomcat7 ,因此我再次安装它,遵循我当时遵循的相同(我)程序:

How to install Strabon for Linux

所以,当我访问http://localhost:8080/时,我得到的是404,就像这样:

HTTP Status 404 - /

type Status report

message /

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

但是当我访问http://localhost:8080/strabonendpoint/时,一切正常!到底是怎么回事?我想在浏览器中访问http://localhost:8080/并收到消息"它有效!"。

端口侦听器:

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

我的/etc/tomcat7/server.xml:

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

我的网络用户:

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

tomcat是否正在侦听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  

/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.

localhost_access_log.2016-03-13.txt的第一行:

127.0.0.1 - - [13/Mar/2016:18:23:26 +0200] "GET / HTTP/1.1" 404 969

1 个答案:

答案 0 :(得分:3)

您的ROOT文件夹的内容是它无法正常工作的原因,为什么strabon将该临时文件和kml文件放在那里我无法说。如果你把&#34; index.html&#34; (我认为)在ROOT文件夹中存档并制作它的内容&#34;它有用!&#34;你能够看到我的意思。

(第二种选择)进入您的网络应用程序文件夹。将应用程序文件夹重命名为ROOT,然后重新启动tomcat,您就可以在您提到的初始Url上访问它。