Linux Tomcat 启动没有错误但没有监听 8080
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11919378/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Tomcat starts without errors but not listening on 8080
提问by nash
I am running tomcat 6 on Centos 6.4 and have started it sucessfully. There were no errors on start. catalina.log reads:
我在 Centos 6.4 上运行 tomcat 6 并成功启动它。启动时没有错误。catalina.log 写道:
2012-08-11 14:23:42,941 | INFO | main | o.a.c.http11.Http11NioProtocol | Starting Coyote HTTP/1.1 on http-xx.xx.xx.xx-8080
2012-08-11 14:23:42,960 | INFO | main | o.a.catalina.startup.Catalina | Server startup in 121483 ms
And ps -x
shows it as running.
并ps -x
显示为正在运行。
Unfortunately it is not responding on port 8080 however and netstat -atnp | grep LISTEN
does not list it.
不幸的是,它在端口 8080 上没有响应,并且netstat -atnp | grep LISTEN
没有列出它。
Any ideas of what could cause this?
关于什么可能导致这种情况的任何想法?
采纳答案by alfasin
If the problem is that the port is not configured in iptables like Nash suggests, then you can configure it as follows:
如果问题是在iptables中没有像Nash建议的那样配置端口,那么你可以如下配置:
vi /etc/sysconfig/iptables
add the following line to the file:
将以下行添加到文件中:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
save the file on exit and restart iptables:
在退出时保存文件并重新启动 iptables:
service iptables restart
回答by nash
It was iptables blocking the port...
是iptables阻塞了端口...
A quick way to solve this is to turn off iptables with:
解决这个问题的一个快速方法是关闭 iptables:
/etc/init.d/iptables save
/etc/init.d/iptables stop
In general iptables should be enabled but configured to open the ports needed. Turning it off without using a replacement is a bad practice.
一般来说,应该启用 iptables,但配置为打开所需的端口。在不使用替代品的情况下将其关闭是一种不好的做法。
In my case the machines were not doing anything sensitive and were on an internal network without internet access so turning off iptables was good enough.
在我的情况下,机器没有做任何敏感的事情,并且在没有互联网访问的内部网络上,所以关闭 iptables 就足够了。
回答by Luciano Marqueto
the answer of @alfasin is correct, but for CentOS 6 the comand line down not work
@alfasin 的答案是正确的,但对于 CentOS 6,命令行不工作
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
You need free chain one by one, this mode:
你需要一一自由连锁,这种模式:
-I INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-I OUTPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-I FORWARD -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
回答by S.M.Fazle Rabbi
I thing following activity will also can be work.But yes, its only for Cent OS. Goto
我接下来的活动也可以工作。但是,是的,它仅适用于 Cent OS。去
vi /etc/sysconfig/iptables
Just add following line and change your port as you want.
只需添加以下行并根据需要更改端口。
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
save the file by pressing escfrom keyboard and type :wq
Then restart iptables:
通过从键盘按esc并键入:wq
然后重新启动 iptables 来保存文件:
service iptables restart
I thing it will be work.
我认为这将是工作。