Cannot ping Localhost so I can't shutdown Tomcat

Posted by gav on Server Fault See other posts from Server Fault or by gav
Published on 2010-03-30T17:40:59Z Indexed on 2010/03/30 23:23 UTC
Read the original article Hit count: 543

Filed under:
|

Hi,

I installed Tomcat 6 using the tar-ball via wget. Startup of the server is fine but on shutdown I get a timeout exception.

root@88:/usr/local/tomcat/logs# /usr/local/tomcat/bin/shutdown.sh 
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar
30-Mar-2010 17:33:41 org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop: 
java.net.ConnectException: Connection timed out
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    ...

I read that this might be because I have a firewall blocking incoming connections on the shutdown port (8005). I have a default Ubuntu 9.04 installation running on a VPS with no rules in my iptables. How can I tell if that port is blocked? How can I check that the server is listening for connections on 8005?

Bizarrely pinging localhost or the IP of my server fails from the server itself, whereas pinging the IP of my server from another machine succeeds.

-------- EDIT -------- (In reply to Davey)

Thanks for all the tips and suggestions!

netstat -nlp

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:8005          0.0.0.0:*               LISTEN      9611/java       
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      28505/mysqld    
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      9611/java       
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      

...

So we can see that tomcat is listening, I just don't seem to be able to reach it.

root@88:/usr/local/tomcat# telnet localhost 8005
Trying 127.0.0.1...

Trying to telnet to the port Hangs indefinitely. I have no rules in my iptables so I don't think it's a firewall thing.

root@88:/usr/local/tomcat# iptables --list
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 

This is the contents of /etc/hosts

127.0.0.1 localhost.localdomain localhost
# Auto-generated hostname. Please do not remove this comment.
88.198.31.14 88.198.31.14  88 88

But I still can't ping localhost... do I need to check a loopback device is enabled properly or something? (I'm unsure how to do that if you do say yes :)).

root@88:/usr/local/tomcat# ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.

--- localhost ping statistics ---
7 packets transmitted, 0 received, 100% packet loss, time 5999ms

Trying to find out what the loop back is configured as;

root@88:~# ifconfig lo
lo        Link encap:Local Loopback  
          LOOPBACK  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

SOLUTION THANKS TO DAVEY

I needed to bring up the interface (Not sure why it wasn't running). ifconfig lo up did the trick.

root@88:~# ifconfig lo up
root@88:~# ifconfig lo
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

root@88:~# ping localhost
PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=0.025 ms

Thanks again,

Gav

© Server Fault or respective owner

Related posts about tomcat

Related posts about tomcat6