• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6199
  • Last Modified:

Can't access Tomcat using public IP address


I can access my website using the public IP of "", no problem.
I've installed and started Tomcat on my server.
I can SSH in to my server and use lynx to view "http://localhost:8080". The Tomcat admin page is displayed.
But I can't access "" from my browser.
Executing "netstat -nap" on my server produces the following...
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0        *                   LISTEN      869/httpd
tcp        0      0 :::80                       :::*                        LISTEN      869/httpd
tcp        0      0 :::8080                     :::*                        LISTEN      32767/java

Open in new window

Note that I only copied rows related to 80 and 8080.
Is the reason why I can't access "" is because there's no "0"?
How do I resolve this?
  • 4
1 Solution
Yes, your installation is only listening on IPv6 port 8080 - you need to tell Java to prefer IPv4 so that Tomcat will be accessible on rather than :::

This (among many other pages) describes the fix:
More specifically, this snippet should get it done:

add: JAVA_OPTS= $JAVA_OPTS -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses to the catalina.sh startup
killdurstAuthor Commented:
Thanks! It works now!
Glad to hear it, enjoy :)
BTW, give yourself a pat on the back - your posting the output from netstat all but made it obvious what the problem was - had you not had that foresight to do so, you might've been battling a lot of speculation going down multiple other avenues before arriving at this simple fix...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now