Solved

Can't access Tomcat using public IP address

Posted on 2013-11-27
5
4,199 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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks! It works now!
0
 
LVL 19

Expert Comment

by:xterm
Comment Utility
Glad to hear it, enjoy :)
0
 
LVL 19

Expert Comment

by:xterm
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now