?
Solved

Can't access Tomcat using public IP address

Posted on 2013-11-27
5
Medium Priority
?
5,187 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

752 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