tomcat运行,但8080端口没有响应

时间:2022-12-07 18:14:01

I have installed sun jdk 1.6 x64 and tomcat in a linux x64 machine through ssh, i don't have root privileges so i installed both in my home dir.

我已经通过ssh在linux x64机器上安装了sun jdk 1.6 x64和tomcat,我没有root权限,所以我在我的家庭目录中安装了两个。

I managed to successful run tomcat but if i try to enter mydomain.com:8080 there's no answer from the server.

我设法成功运行tomcat,但如果我尝试进入mydomain.com:8080,那么服务器没有答案。

With this command:

使用此命令:

netstat -atnp|grep LISTEN

i checked the port and it is LISTENING

我检查了端口,它正在聆听

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>

Any ideas of what is the problem?

有什么问题的想法?

Thanks in advance and sorry for the terrible english I wrote.

在此先感谢,并为我写的可怕英语感到抱歉。

6 个解决方案

#1


18  

First step is to run telnet localhost 8080 when logged in locally. Then type in something like

第一步是在本地登录时运行telnet localhost 8080。然后键入类似的内容

GET /

and you should get HTML back. If that doesn't work, then tomcat is not really running properly or is not listening on port 8080. If that works but when trying from outside, make sure that you have the correct ip address. Try with ip address first. If ip address works, perhaps your mydomain.com doesn't resolve to it. If ip is correct (the same one you are ssh'ing to) and it still doesn' work, then you are probably running firewall which doesn't allow 8080 through. Changing firewall configuration requires root access.

你应该得到HTML。如果这不起作用,那么tomcat实际上并没有正常运行或者没有在端口8080上侦听。如果这样可行但是从外部尝试时,请确保您拥有正确的IP地址。首先尝试使用ip地址。如果IP地址有效,也许您的mydomain.com无法解析它。如果ip是正确的(你正在使用同一个)并且它仍然没有工作,那么你可能正在运行防火墙,它不允许8080通过。更改防火墙配置需要root访问权限

#2


6  

Try to list out using following command on Linux terminal LISTEN TCP Addresses and port details with program name

尝试在Linux终端上使用以下命令列出LISTEN TCP地址和程序名称的端口详细信息

netstat -ltnpa | grep -i --colour LISTEN

Further you have to check firewall is turn on or off. (Most of the time there might be turn on and may have blocked the specific default tomcat 8080 port blocked by iptables in linux)

此外,您必须检查防火墙是否打开或关闭。 (大多数情况下可能会打开并且可能阻止了linux中iptables阻止的特定默认tomcat 8080端口)

#3


4  

The problem for me was that my Tomcat started listening to IPv6 ONLY. Putting it here in case somebody else finds out the same thing.

对我来说问题是我的Tomcat开始只听IPv6。把它放在这里以防其他人发现同样的事情。

I was able to get proper responses with

我得到了适当的回应

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

But not with localhost. To fix this, I removed address attribute from conf/server.xml:

但不是localhost。为了解决这个问题,我从conf / server.xml中删除了address属性:

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

and restarted and it bound to IPv4 again. I know it should be other way around, but this was what fixed it for me. OS was Ubuntu.

并重新启动,它再次绑定到IPv4。我知道它应该是另一种方式,但这是为我解决的问题。操作系统是Ubuntu。

#4


2  

Close the IDE. Restart the process java.exe if you are on a windows system. And fire up the IDE after that.

关闭IDE。如果您在Windows系统上,请重新启动进程java.exe。然后启动IDE。

#5


0  

In case of war deployment if there is error in war file, tomcat may not be able to extract the war file. Make sure a folder having same name as war file is created in tomcat//libexec/webapps otherwise localhost:8080 will stuck.

如果战争部署中如果war文件中存在错误,则tomcat可能无法提取war文件。确保在tomcat // libexec / webapps中创建与war文件同名的文件夹,否则localhost:8080将卡住。

#6


0  

Tomcat may be too slow to start if one of the deployed applications is too slow to initialize. You can tell this is the case when you've started Tomcat, yet the browser says the server isn't responding, even though you can see that the port is listening (by connecting with telnet). Also note that your CPU usage may be too high. In my case, it was because I had enabled TRACE mode on the logger.

如果其中一个已部署的应用程序启动速度太慢,Tomcat可能启动速度太慢。您可以在启动Tomcat时判断出这种情况,但浏览器说服务器没有响应,即使您可以看到端口正在侦听(通过连接telnet)。另请注意,您的CPU使用率可能过高。就我而言,这是因为我在记录器上启用了TRACE模式。

#1


18  

First step is to run telnet localhost 8080 when logged in locally. Then type in something like

第一步是在本地登录时运行telnet localhost 8080。然后键入类似的内容

GET /

and you should get HTML back. If that doesn't work, then tomcat is not really running properly or is not listening on port 8080. If that works but when trying from outside, make sure that you have the correct ip address. Try with ip address first. If ip address works, perhaps your mydomain.com doesn't resolve to it. If ip is correct (the same one you are ssh'ing to) and it still doesn' work, then you are probably running firewall which doesn't allow 8080 through. Changing firewall configuration requires root access.

你应该得到HTML。如果这不起作用,那么tomcat实际上并没有正常运行或者没有在端口8080上侦听。如果这样可行但是从外部尝试时,请确保您拥有正确的IP地址。首先尝试使用ip地址。如果IP地址有效,也许您的mydomain.com无法解析它。如果ip是正确的(你正在使用同一个)并且它仍然没有工作,那么你可能正在运行防火墙,它不允许8080通过。更改防火墙配置需要root访问权限

#2


6  

Try to list out using following command on Linux terminal LISTEN TCP Addresses and port details with program name

尝试在Linux终端上使用以下命令列出LISTEN TCP地址和程序名称的端口详细信息

netstat -ltnpa | grep -i --colour LISTEN

Further you have to check firewall is turn on or off. (Most of the time there might be turn on and may have blocked the specific default tomcat 8080 port blocked by iptables in linux)

此外,您必须检查防火墙是否打开或关闭。 (大多数情况下可能会打开并且可能阻止了linux中iptables阻止的特定默认tomcat 8080端口)

#3


4  

The problem for me was that my Tomcat started listening to IPv6 ONLY. Putting it here in case somebody else finds out the same thing.

对我来说问题是我的Tomcat开始只听IPv6。把它放在这里以防其他人发现同样的事情。

I was able to get proper responses with

我得到了适当的回应

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

But not with localhost. To fix this, I removed address attribute from conf/server.xml:

但不是localhost。为了解决这个问题,我从conf / server.xml中删除了address属性:

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

and restarted and it bound to IPv4 again. I know it should be other way around, but this was what fixed it for me. OS was Ubuntu.

并重新启动,它再次绑定到IPv4。我知道它应该是另一种方式,但这是为我解决的问题。操作系统是Ubuntu。

#4


2  

Close the IDE. Restart the process java.exe if you are on a windows system. And fire up the IDE after that.

关闭IDE。如果您在Windows系统上,请重新启动进程java.exe。然后启动IDE。

#5


0  

In case of war deployment if there is error in war file, tomcat may not be able to extract the war file. Make sure a folder having same name as war file is created in tomcat//libexec/webapps otherwise localhost:8080 will stuck.

如果战争部署中如果war文件中存在错误,则tomcat可能无法提取war文件。确保在tomcat // libexec / webapps中创建与war文件同名的文件夹,否则localhost:8080将卡住。

#6


0  

Tomcat may be too slow to start if one of the deployed applications is too slow to initialize. You can tell this is the case when you've started Tomcat, yet the browser says the server isn't responding, even though you can see that the port is listening (by connecting with telnet). Also note that your CPU usage may be too high. In my case, it was because I had enabled TRACE mode on the logger.

如果其中一个已部署的应用程序启动速度太慢,Tomcat可能启动速度太慢。您可以在启动Tomcat时判断出这种情况,但浏览器说服务器没有响应,即使您可以看到端口正在侦听(通过连接telnet)。另请注意,您的CPU使用率可能过高。就我而言,这是因为我在记录器上启用了TRACE模式。