tessiof
tessiof

Reputation: 117

Tomcat won't respond on port 8080

Tomcat is listening on port 8080, but it do not respond correctly to HTTP requests. I'm running an updated Centos 6.2, and Tomcat is installed from the package tomcat6.

Tomcat is running and listening on port 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

But when I connect to port 8080, I get a "Connection closed by foreign host" message:

# 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.           

It's important to note that it do connect to port 8080, but the connection is closed when anything is sent on the connection stream:

# 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   -  

The logs show no error messages:

# 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

For the peace of mind, I checked the firewall:

# 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   

How can I do any further troubleshooting!? Thanks!

Upvotes: 4

Views: 22994

Answers (1)

amit
amit

Reputation: 2061

It could be that you don't have any application deployed on your ROOT?

can you post the content of your /tomcat/webapps/* ?

say you have application.war deployed so you'd rather do

GET /application/something

I just tested on my working tomcat and when calling GET / it also returns nothing because there is no application deployed over there (default for root in tomcat is /tomcat/webapps/ROOT)

Hope I could help.

Upvotes: 2

Related Questions