Solved

Can't access Tomcat using public IP address

Posted on 2013-11-27
5
4,728 Views
Last Modified: 2013-11-28
Hi,

I can access my website using the public IP of "http://192.232.254.240:80", 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 "http://192.232.254.240:8080" 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 0.0.0.0:80                  0.0.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 "http://192.232.254.240:8080" is because there's no "0 0.0.0.0:8080"?
How do I resolve this?
Thanks.
0
Comment
Question by:killdurst
  • 4
5 Comments
 
LVL 19

Expert Comment

by:xterm
ID: 39682833
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 0.0.0.0 rather than :::

This (among many other pages) describes the fix:
http://serverfault.com/questions/390840/how-does-one-get-tomcat-to-bind-to-ipv4-address
0
 
LVL 19

Accepted Solution

by:
xterm earned 500 total points
ID: 39682836
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
0
 
LVL 1

Author Comment

by:killdurst
ID: 39682858
Thanks! It works now!
0
 
LVL 19

Expert Comment

by:xterm
ID: 39682913
Glad to hear it, enjoy :)
0
 
LVL 19

Expert Comment

by:xterm
ID: 39682918
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...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question