Tomcat不会在端口8080上响应

Tomcat正在侦听端口8080,但是它不能正确响应HTTP请求。 我正在运行一个更新的Centos 6.2,Tomcat是从tomcat6包安装的。

Tomcat正在运行并侦听端口8080。

# netstat -tlnp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:8009 0.0.0.0:* LISTEN 9214/java tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 9214/java tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 981/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1057/master tcp 0 0 127.0.0.1:8005 0.0.0.0:* LISTEN 9214/java # ps aux | grep -i tomcat tomcat 9214 0.0 10.0 164556 51516 ? Sl 15:00 0:01 /usr/lib/jvm/jre/bin/java -Djavax.sql.DataSource.Factory=org.apache.commons.dbcp.BasicDataSourceFactory -classpath :/usr/share/tomcat6/bin/bootstrap.jar:/usr/share/tomcat6/bin/tomcat-juli.jar:/usr/share/java/commons-daemon.jar -Dcatalina.base=/usr/share/tomcat6 -Dcatalina.home=/usr/share/tomcat6 -Djava.endorsed.dirs= -Djava.io.tmpdir=/var/cache/tomcat6/temp -Djava.util.logging.config.file=/usr/share/tomcat6/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager org.apache.catalina.startup.Bootstrap start 

但是,当我连接到端口8080,我得到一个“由外部主机closures连接”消息:

 # telnet localhost 8080 Trying ::1... telnet: connect to address ::1: Connection refused Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET / Connection closed by foreign host. 

请注意,它连接到端口8080是很重要的,但在连接stream上发送任何内容时连接将被closures:

 # netstat -tnp Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:8080 127.0.0.1:54553 TIME_WAIT - 

日志显示没有错误消息:

 # tail /var/log/tomcat6/catalina.out Aug 26, 2013 3:00:36 pm org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/6.0.24 Aug 26, 2013 3:00:36 pm org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on http-8080 Aug 26, 2013 3:00:36 pm org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on /0.0.0.0:8009 Aug 26, 2013 3:00:36 pm org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/19 config=null Aug 26, 2013 3:00:36 pm org.apache.catalina.startup.Catalina start INFO: Server startup in 144 ms # tail /var/log/messages Aug 26 13:17:45 sugar yum[1120]: Installed: regexp-1.5-4.4.el6.i686 Aug 26 13:17:46 sugar yum[1120]: Installed: bcel-5.2-7.2.el6.i686 Aug 26 13:17:46 sugar yum[1120]: Installed: 1:mx4j-3.0.1-9.13.el6.noarch Aug 26 13:17:46 sugar yum[1120]: Installed: tomcat6-lib-6.0.24-57.el6_4.noarch Aug 26 13:17:46 sugar yum[1120]: Installed: tomcat6-6.0.24-57.el6_4.noarch Aug 26 14:42:06 sugar kernel: ip_tables: (C) 2000-2006 Netfilter Core Team Aug 26 14:44:07 sugar yum[8994]: Installed: gpm-libs-1.20.6-12.el6.i686 Aug 26 14:44:07 sugar yum[8994]: Installed: gc-7.1-10.el6.i686 Aug 26 14:44:08 sugar yum[8994]: Installed: w3m-0.5.2-16.el6.i686 Aug 26 14:54:07 sugar yum[9068]: Installed: 1:telnet-0.17-47.el6_3.1.i686 # pwd /var/log/tomcat6 # ll total 24 -rw-r--r-- 1 tomcat tomcat 8277 Aug 26 15:00 catalina.2013-08-26.log -rw-r--r-- 1 tomcat tomcat 12112 Aug 26 15:31 catalina.out -rw-r--r-- 1 tomcat tomcat 0 Aug 26 13:23 host-manager.2013-08-26.log -rw-r--r-- 1 tomcat tomcat 0 Aug 26 13:23 localhost.2013-08-26.log -rw-r--r-- 1 tomcat tomcat 0 Aug 26 13:23 manager.2013-08-26.log 

为了安心,我检查了防火墙:

 # iptables -L -vn Chain INPUT (policy ACCEPT 6042 packets, 1563K bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 4122 packets, 587K bytes) pkts bytes target prot opt in out source destination 

我怎样才能进一步排除故障! 谢谢!

这可能是因为你没有在你的ROOT上部署任何应用程序?

你可以发布你的/tomcat/webapps/*吗?

说你有部署application.war所以你宁愿这样做

 GET /application/something 

我刚刚在我的工作tomcat上测试,当调用GET /它也没有返回,因为没有应用程序部署在那里(默认的根目录在tomcat是/tomcat/webapps/ROOT

希望我能帮上忙。