2011-12-18 91 views
10

我已經通過ssh在linux x64機器上安裝了sun jdk 1.6 x64和tomcat,我沒有root權限,所以我在我的家目錄中都安裝了這兩個。tomcat正在運行,但8080端口沒有響應

我成功地運行了tomcat,但是如果我嘗試輸入mydomain.com:8080,服務器沒有答案。

使用這個命令:

netstat -atnp|grep LISTEN 

我檢查的端口,它是偵聽

Dec 18, 2011 5:11:20 PM org.apache.catalina.core.AprLifecycleListener init 
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /home2/fiegmund/jdk1.6.0_25/jre/lib/amd64/server:/home2/fiegmund/jdk1.6.0_25/jre/lib/amd64:/home2/fiegmund/jdk1.6.0_25/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib 
Dec 18, 2011 5:11:21 PM org.apache.coyote.AbstractProtocol init 
INFO: Initializing ProtocolHandler ["http-bio-8080"] 
Dec 18, 2011 5:11:21 PM org.apache.coyote.AbstractProtocol init 
INFO: Initializing ProtocolHandler ["ajp-bio-8009"] 
Dec 18, 2011 5:11:21 PM org.apache.catalina.startup.Catalina load 
INFO: Initialization processed in 2015 ms 
Dec 18, 2011 5:11:21 PM org.apache.catalina.core.StandardService startInternal 
INFO: Starting service Catalina 
Dec 18, 2011 5:11:21 PM org.apache.catalina.core.StandardEngine startInternal 
INFO: Starting Servlet Engine: Apache Tomcat/7.0.23 
Dec 18, 2011 5:11:21 PM org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory /home2/fiegmund/apache-tomcat-7.0.23/webapps/docs 
Dec 18, 2011 5:11:24 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom 
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [1,869] milliseconds. 
Dec 18, 2011 5:11:24 PM org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory /home2/fiegmund/apache-tomcat-7.0.23/webapps/manager 
Dec 18, 2011 5:11:24 PM org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory /home2/fiegmund/apache-tomcat-7.0.23/webapps/ROOT 
Dec 18, 2011 5:11:24 PM org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory /home2/fiegmund/apache-tomcat-7.0.23/webapps/examples 
Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined 
Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined 
Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined 
Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined 
Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined 
Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined 
Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined 
Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined 
Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined 
Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined 
Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined 
Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined 
Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined 
Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined 
Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined 
Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory /home2/fiegmund/apache-tomcat-7.0.23/webapps/host-manager 
Dec 18, 2011 5:11:25 PM org.apache.coyote.AbstractProtocol start 
INFO: Starting ProtocolHandler ["http-bio-8080"] 
Dec 18, 2011 5:11:25 PM org.apache.coyote.AbstractProtocol start 
INFO: Starting ProtocolHandler ["ajp-bio-8009"] 
Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.Catalina start 
INFO: Server startup in 4582 ms> 

的是什麼問題任何想法?

在此先感謝,並對我寫的可怕英語感到抱歉。

+0

從本地機器本身telnet是否工作? – fge 2011-12-18 20:47:07

+0

是的,它確實連接 – 2011-12-18 20:48:39

+0

那麼很可能您的託管服務提供商不允許在1024以上的端口上收聽... – fge 2011-12-18 20:49:54

回答

16

第一步是在本地登錄時運行telnet localhost 8080。然後輸入類似於

GET/

並且您應該返回HTML。 如果這不起作用,那麼tomcat實際上運行不正常,或者沒有在端口8080上偵聽。 如果這種方式有效,但是從外部嘗試時,請確保您具有正確的IP地址。首先嚐試使用IP地址。如果IP地址有效,也許你的mydomain.com不能解決它。 如果ip是正確的(與ssh相同的一個),它仍然不起作用,那麼你可能運行的防火牆不允許8080通過。更改防火牆配置需要root權限。

+0

需要大約8分鐘的時間,我忘記告訴服務器已經使用端口80安裝了Apache http服務器。無論如何,我嘗試使用:lwp-request http:// localhost:8080和我得到的Apache的Tomcat的HTML ... – 2011-12-18 20:54:03

+0

所以防火牆是問題,非常感謝你 – 2011-12-18 20:56:01

+0

GET /,而不是http:// localhost/ – 2011-12-18 20:58:08

3

關閉IDE。如果您位於Windows系統上,請重新啓動java.exe進程。然後啓動IDE。

+1

這不是IDE問題。 OP明確指出這是一臺具有SSH訪問權限的Linux服務器。 – milosmns 2017-11-04 15:04:56

4

嘗試列出了使用下面的命令在Linux終端LISTEN TCP地址和端口的詳細程序名爲

netstat -ltnpa | grep -i --colour LISTEN 

而且你必須檢查防火牆的開啓或關閉。 (大多數時間可能會打開,並可能已經阻止了iptables在Linux中阻止的特定默認tomcat 8080端口)

4

對我來說,問題在於我的Tomcat開始只聽IPv6。把它放在這裏以防別人發現同樣的事情。

我能得到與

curl -g -6 "http://[::1]:8080/" 

但不能與本地主機適當的響應。 爲了解決這個問題,我移除了的conf/server.xml中address屬性:

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

並重新啓動並再次將其綁定到的IPv4。我知道它應該是另一種方式,但這是爲我修復的。操作系統是Ubuntu。

0

如果戰爭部署時,如果war文件中有錯誤,tomcat可能無法提取war文件。確保在tomcat中創建了與war文件具有相同名稱的文件夾// libexec/webapps否則localhost:8080將卡住。

相關問題