Cannot access Tomact 9 from browser

July 31, 2017 3.3k views
Apache Applications Ubuntu 16.04

Hi,

I installed Tomcat 9 on my dorplet with Ubuntu 16.04 following this tutorial

[https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-16-04]

I’ve changed the default port to 8181 because I have another service running on 8080 and started the service. If I check with

sudo systemctl status tomcat

it is running just fine.

If I check the ufw status the respons is good.

Status: active

To Action From


8181 ALLOW Anywhere

8181 (v6) ALLOW Anywhere (v6)

But when I try to reach the server in my webbrowser I get “Safari can’t open the page http://<my_IP>:8181 because Safari can’t connect to the Server <my_IP>”.

What could be the problem?

Thanks

1 Answer

Hi @imeyer1

Can you run this command to make sure it’s listening on right port, and on the outside interface and not just localhost:

sudo lsof -iTCP -sTCP:LISTEN -P
  • Hi @hansen
    you were right, the port listen to localhost.

    COMMAND    PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
    postgres  1414 postgres    6u  IPv4  15583      0t0  TCP *:5432 (LISTEN)
    postgres  1414 postgres    7u  IPv6  15584      0t0  TCP *:5432 (LISTEN)
    java      6941   tomcat   56u  IPv6  56526      0t0  TCP localhost:8005 (LISTEN)
    sshd     11392     root    3u  IPv4  79963      0t0  TCP *:22 (LISTEN)
    sshd     11392     root    4u  IPv6  79965      0t0  TCP *:22 (LISTEN)
    
    

    I tried to change te context.xml commenting this as suggested in another post, but it didn’t help

    <Context antiResourceLocking="false" privileged="true" >
      <!--<Valve className="org.apache.catalina.valves.RemoteAddrValve"
             allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />-->
    </Context>
    

    I’m very new to all this, do you have any suggestion?

  • Hi @hansen

    I have the same issue. Running Debian and followed the install instructions step by step. What would you recommend. See below

    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    sshd 795 root 3u IPv4 13772 0t0 TCP *:22 (LISTEN)
    sshd 795 root 4u IPv6 13781 0t0 TCP *:22 (LISTEN)
    mysqld 13637 mysql 17u IPv4 61086 0t0 TCP localhost:3306 (LISTEN)
    java 17380 tomcat8 57u IPv6 80247 0t0 TCP *:8080 (LISTEN)
    java 17380 tomcat8 70u IPv6 83640 0t0 TCP localhost:8005 (LISTEN)

Have another answer? Share your knowledge.