Linux – Connections Timed Out – Tomcat

linuxtomcatUbuntu

I'm having a problem with Tomcat:

On a clean install, connecting to [ip-address]:8080 times out.

I have seen many similar questions and tried basically everything there, with no success. But here is all my data related to similar problems:

Version: Tomcat 7

Linux: Ubuntu

iptables -L output:

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

netstat -nat | grep :8080 output

tcp6       0      0 :::8080                 :::*                    LISTEN

telnet localhost 8080 output

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

telnet [ip-address] 8080 output

Trying [ip-address]... (this seems to go on forever)

I feel like I must be missing something incredibly obvious, as I have not added any WARs/made any modifications to the server except installing java and tomcat.
Below is my Server.xml (comments removed):

<?xml version='1.0' encoding='utf-8'?>

<Server port="8005" shutdown="SHUTDOWN">

  <Listener className="org.apache.catalina.core.JasperListener" />

  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  <GlobalNamingResources>

    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <Service name="Catalina">

    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               URIEncoding="UTF-8"
               redirectPort="8443" address="0.0.0.0"  />

    <Engine name="Catalina" defaultHost="localhost">

      <Realm className="org.apache.catalina.realm.LockOutRealm">

        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>
    </Engine>
  </Service>
</Server>

Best Answer

Since you are on Amazon EC2, and it's working local to the instance but not to its IP address, check your host's network ACL (i.e. security group). The wizard guides you to set up a very restrictive policy, and if you try to do something like open up HTTP to the world, it will just open inbound port 80.