Tomcat正在侦听端口8080,但它没有正确响应HTTP请求。 我正在运行更新的Centos 6.2,并且已经从包tomcat6安装了Tomcat。
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时,我收到“外部主机已关闭连接”消息:
# 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,但在连接流上发送任何内容时关闭连接:
# 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 p.m. org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.24
Aug 26, 2013 3:00:36 p.m. org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Aug 26, 2013 3:00:36 p.m. org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Aug 26, 2013 3:00:36 p.m. org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/19 config=null
Aug 26, 2013 3:00:36 p.m. 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
如何进行进一步的故障排除!? 谢谢!
答案 0 :(得分:2)
可能是您没有在ROOT上部署任何应用程序?
您可以发布/tomcat/webapps/*
的内容吗?
说你已经部署了application.war
,所以你宁愿做
GET /application/something
我刚刚在我的工作tomcat上测试过,当调用GET /
时,它也没有返回任何内容,因为那里没有部署应用程序(tomcat中的root的默认值为/tomcat/webapps/ROOT
)
希望我能提供帮助。