Tomcat is running but 8080 port is not responding

90,662

Solution 1

First step is to run telnet localhost 8080 when logged in locally. Then type in something like

GET /

and you should get HTML back. If that doesn't work, then tomcat is not really running properly or is not listening on port 8080. If that works but when trying from outside, make sure that you have the correct ip address. Try with ip address first. If ip address works, perhaps your mydomain.com doesn't resolve to it. If ip is correct (the same one you are ssh'ing to) and it still doesn' work, then you are probably running firewall which doesn't allow 8080 through. Changing firewall configuration requires root access.

Solution 2

The problem for me was that my Tomcat started listening to IPv6 ONLY. Putting it here in case somebody else finds out the same thing.

I was able to get proper responses with

curl -g -6 "http://[::1]:8080/"

But not with localhost. To fix this, I removed address attribute from conf/server.xml:

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

and restarted and it bound to IPv4 again. I know it should be other way around, but this was what fixed it for me. OS was Ubuntu.

Solution 3

Try to list out using following command on linux terminal TCP IP and port reference to the application like "java" as below.

[root@h5 ~]# netstat -ltnp | grep java -i --colour 
tcp        0      0 10.15.11.20:9990    0.0.0.0:*               LISTEN      1626/java           
tcp        0      0 10.15.11.20:8080    0.0.0.0:*               LISTEN      1626/java           
tcp        0      0 10.15.11.20:8443    0.0.0.0:*               LISTEN      1626/java 
   

Further first you need to check the open ports at the firewall.

firewall-cmd --list-ports

If it is turn on and port is not there please allow the relevant port 8080 as below.

firewall-cmd --permanent --zone=public --add-port=8080
firewall-cmd --reload

Solution 4

On CentOs I had to open the firewall manually

sudo firewall-cmd --zone=public --add-port=7999/tcp --permanent
sudo firewall-cmd --reload

Not sure how, but if Docker was running a container on the same port, it would automatically open the firewall and so was throwing me off

Share:
90,662
Ulises Layera
Author by

Ulises Layera

Updated on December 24, 2021

Comments

  • Ulises Layera
    Ulises Layera over 2 years

    I have installed sun jdk 1.6 x64 and tomcat in a linux x64 machine through ssh, I don't have root privileges so I installed both in my home dir.

    I managed to successful run tomcat but if I try to enter mydomain.com:8080 there's no answer from the server.

    With this command:

    netstat -atnp|grep LISTEN
    

    I checked the port and it is LISTENING

    Dec 18, 2011 5:11:20 PM org.apache.catalina.core.AprLifecycleListener init
    INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /home2/fiegmund/jdk1.6.0_25/jre/lib/amd64/server:/home2/fiegmund/jdk1.6.0_25/jre/lib/amd64:/home2/fiegmund/jdk1.6.0_25/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
    Dec 18, 2011 5:11:21 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["http-bio-8080"]
    Dec 18, 2011 5:11:21 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
    Dec 18, 2011 5:11:21 PM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 2015 ms
    Dec 18, 2011 5:11:21 PM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service Catalina
    Dec 18, 2011 5:11:21 PM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat/7.0.23
    Dec 18, 2011 5:11:21 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory /home2/fiegmund/apache-tomcat-7.0.23/webapps/docs
    Dec 18, 2011 5:11:24 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
    INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [1,869] milliseconds.
    Dec 18, 2011 5:11:24 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory /home2/fiegmund/apache-tomcat-7.0.23/webapps/manager
    Dec 18, 2011 5:11:24 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory /home2/fiegmund/apache-tomcat-7.0.23/webapps/ROOT
    Dec 18, 2011 5:11:24 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory /home2/fiegmund/apache-tomcat-7.0.23/webapps/examples
    Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
    Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
    Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
    Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
    Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
    Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined
    Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
    Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined
    Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
    Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
    Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
    Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined
    Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
    Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
    Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
    Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory /home2/fiegmund/apache-tomcat-7.0.23/webapps/host-manager
    Dec 18, 2011 5:11:25 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["http-bio-8080"]
    Dec 18, 2011 5:11:25 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["ajp-bio-8009"]
    Dec 18, 2011 5:11:25 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 4582 ms>
    

    Any ideas that what is the problem?

  • Ulises Layera
    Ulises Layera over 12 years
    i forgot to tell that the server have already installed Apache http Server using port 80. Anyway, i tried with: lwp-request localhost:8080 and i got the html of apache tomcat...
  • Tobia
    Tobia almost 8 years
    I checked ports with netstat, and I got :::8080 and 0.0.0.0:8080. Telnetting GET / it doesn't reply at all. I have good logs from web app startup. What should I check?
  • milosmns
    milosmns over 6 years
    This is not an IDE problem. OP clearly states that it's a Linux server with SSH access.
  • sametcodes
    sametcodes about 5 years
    you saved my day!
  • pawello2222
    pawello2222 over 3 years
    Link-only answers are discouraged, please include the most important code in your answer.