Tomcat starts without errors but not listening on 8080
Asked Answered
E

4

9

I am running tomcat 6 on Centos 6.4 and have started it sucessfully. There were no errors on start. catalina.log reads:

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.

Unfortunately it is not responding on port 8080 however and netstat -atnp | grep LISTEN does not list it.

Any ideas of what could cause this?

Emulsify answered 12/8, 2012 at 2:59 Comment(2)
Hi - The fact that "netstat -atnp" doesn't show a listener for port 8080, unfortunately, doesn't mean anything. SUGGESTION: Try "telnet localhost 8080", followed by "GET / HTTP/1.1", and hit "ENTER" a couple of times. See if you connect. See if you get a response from Tomcat. And double-check your Apache (not Tomcat) logs.Colenecoleopteran
telnet localhost 8080 fails with connection refused. telnet <the ip> 8080 does return things locally but not remotely.Emulsify
G
8

If the problem is that the port is not configured in iptables like Nash suggests, then you can configure it as follows:

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:

service iptables restart
Gujranwala answered 12/8, 2012 at 5:41 Comment(0)
G
6

the answer of @alfasin is correct, but for CentOS 6 the comand line down not work

-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
Gibbosity answered 24/1, 2014 at 14:10 Comment(0)
E
0

It was iptables blocking the port...

A quick way to solve this is to turn off iptables with:

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

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.

Emulsify answered 12/8, 2012 at 5:33 Comment(0)
R
0

I thing following activity will also can be work.But yes, its only for Cent OS. Goto

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 esc from keyboard and type :wq Then restart iptables:

service iptables restart

I thing it will be work.

Rianon answered 10/5, 2019 at 5:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.