?
Solved

Tomcat cannot connect to localhost

Posted on 2011-09-08
8
Medium Priority
?
746 Views
Last Modified: 2012-05-12
During the service restart I get the following error:

org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop:
java.net.ConnectException: Connection timed out

Seems that Tomcat cannot connect to localhost.

Indeed, when I execute

# telnet localhost
Trying xx.xx.xx.xx...
telnet: connect to address xx.xx.xx.xx: Connection timed out
telnet: Unable to connect to remote host: Connection timed out
 
xx.xx.xx.xx - some IP I use on the server, not the main one - and not 127.0.0.1(!)

in /etc/hosts
127.0.0.1       localhost.localdomain  localhost

Any ideas will be appreciated.
0
Comment
Question by:twolines
  • 4
  • 3
8 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 36507092
Try if you can ping the host by that IP which you use
0
 

Author Comment

by:twolines
ID: 36507107
ping localhost gives this IP address, xx.xx.xx.xx, but not 127.0.0.1
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36507170
Try to ping on that ip rather than by local host - the sa$me way tomcat wants to reach it
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:twolines
ID: 36507217
this IP is also pingable
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36507245
Do you think telnet to localhost worked before when tomcat was also operating?
0
 

Author Comment

by:twolines
ID: 36507289
no idea, for being honest..
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36507342
Is this a big server? Perhaps youi can try to reboot the system. This is probably somenetwork issue
0
 
LVL 8

Accepted Solution

by:
n_sachin1 earned 2000 total points
ID: 36508703
When java attempts to resolve the localhost, it also attempts to get the hostname and connect to it to fetch the ip. If there is a conflict anywhere, you will get into these issues

1. try ipconfig (if you are on windows) to check if your ip is what you think it is.
2. try hostname and see if that returns your actual host name
3. try ping -a <your ip> and see if that resolves to your actual hostname

Basically, your network configuration has gone awry
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

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

850 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