Solved

Tomcat cannot connect to localhost

Posted on 2011-09-08
8
714 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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 500 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
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 …
The viewer will learn how to implement Singleton Design Pattern in Java.

832 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