34

I am trying to run Tomcat through Eclipse. This is something that I have done for the past several years. It was working yesterday and now it is not. The error I get is

Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.

The Output is

Jul 06, 2012 8:32:26 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Program Files\Java\jdk1.7.0_05\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\;D:\Launch;D:\Program Files\Java\jdk1.7.0_05\bin;%PROGRAMFILES%\Internet Explorer;C:\Program Files (x86)\SMLNJ\bin\;D:\Program Files\TortoiseSVN\bin;C:\ghc\ghc-6.6\bin;D:\Program Files\MySQL\MySQL Server 5.5\bin;%ANT_HOME%/bin;D:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;D:\Program Files\Microsoft SQL Server\100\Tools\Binn\;D:\Program Files\Microsoft SQL Server\100\DTS\Binn\;D:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;D:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;D:\Program Files (86x)\;.
Jul 06, 2012 8:32:26 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jul 06, 2012 8:32:26 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jul 06, 2012 8:32:26 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 468 ms
Jul 06, 2012 8:32:26 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jul 06, 2012 8:32:26 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.28
Jul 06, 2012 8:32:26 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\Program Files\Java\apache-tomcat-7.0.28\webapps\docs
Jul 06, 2012 8:32:26 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\Program Files\Java\apache-tomcat-7.0.28\webapps\examples
Jul 06, 2012 8:32:26 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Jul 06, 2012 8:32:26 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Jul 06, 2012 8:32:26 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@5710ddf9')
Jul 06, 2012 8:32:26 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\Program Files\Java\apache-tomcat-7.0.28\webapps\host-manager
Jul 06, 2012 8:32:26 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\Program Files\Java\apache-tomcat-7.0.28\webapps\manager
Jul 06, 2012 8:32:26 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\Program Files\Java\apache-tomcat-7.0.28\webapps\ROOT
Jul 06, 2012 8:32:26 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jul 06, 2012 8:32:26 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jul 06, 2012 8:32:26 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 504 ms

I have looked around for a solution for several hours now. But I have not had any success and it likely is something simple. I have tried the following:

  1. Delete Serve and remake it in eclipse
  2. Restart computer, eclipse
  3. Reinstall eclipse, tomcat
  4. Start Eclipse with -clean
  5. Start server with no web app
  6. Increasing the timeout

I am able to start tomcat from command line just fine. However, I need to run it through eclipse to debug. I am aware of this SO post and have gone through it and many others to no avail.

Thoughts?

UPDATE: I just realized that the server does start up. However, one of the final functions that eclipse does, fails. How I observed this is by setting the timeout to 10 min. I was able to access the server during that time, however not the debug functionality of eclipse. So Eclipse starts it up, tries do something, that something never completes, Eclipse shuts down Tomcat after that timeout period.

UPDATE: Looking back at what happened around when this problem arose, the computer apparently installed a Java update.

5
  • Weird, the log seems to indicate that Tomcat started correctly. Did you try to access your webapp on port 8080 despite the error in Eclipse ? It looks like a communication problem between Tomcat and the Eclipse plugin. Do you have a firewall running ? Commented Jul 7, 2012 at 3:30
  • and yes I did attempt to access it. As explained in the update I can access it before the timeout. Commented Jul 7, 2012 at 5:41
  • ya. I have been using the newest one. I downloaded it off the site today. It is the Juno version. Commented Jul 7, 2012 at 6:30
  • Also have tried using the Helio version. Also both tomcat 6 and tomcat 7 Commented Jul 7, 2012 at 7:20
  • 1
    Looks like a duplicate of stackoverflow.com/questions/7390078/… which I answered. Try changing the HTTP port number from the configuration view to something else, for example 8090. Commented Aug 31, 2012 at 12:28

30 Answers 30

39

A Java update caused the same problem (among others) for me. The update caused Eclipse to use ipv6 when pinging Tomcat and for some reason that doesn't work with my setup.

I fixed it by adding

-Djava.net.preferIPv4Stack=true

To eclipse.ini.

Sign up to request clarification or add additional context in comments.

4 Comments

This was a life saver. How did you find out?
I tried this to no avail. I also disabled all IPv6 in all of my network adapters with no change.
In the end I blew away by Eclipse install and my workspace directory. Doing a reinstall resolved the issue. I left IPv6 enabled. ; 64-bit JDK installed java version "1.7.0_09" Java(TM) SE Runtime Environment (build 1.7.0_09-b05) ; Eclipse Juno 64-bit (build 20120920-0800) ; Core tar.gz apache-tomcat-7.0.35 (untouched)
The fix worked. The problem shows up if you increase your server's timeout value and then invoke HappyAxis.jsp. It shows that Version Service is not working. However the same url works in a browser. After the fix its happy. Now, Is there an way to get my Eclipse to talk with the Tomcat server using IPv6?
27

I've found that this can happen due to invalid/corrupted/??? breakpoints in your code when you start in "Debug". It is often accompanied by slow start up times.

"Remove All Breakpoints" cleared this up for me.

5 Comments

That was it! Eclipse should somehow show notification or throw an exception. Took me days to find this.
Saved me as well
This saved my whole day. Didn't understand why the project doesn't work suddenly, but now it's clear. I had made a breakpoint in other project. Thank you so much.
Somebody give this guy an award. Btw, here is how you remove the breakpoints Run-> Remove All Breakpoints
posting in 2021, this solution saved my time from troubleshooting too! Tomcat does not want to boot up in debug due to multiple breakpoints set, removing all the existing breakpoint fixed it. Thanks!! if anyone is wondering, here is my eclipse IDE version: Version: 2019-03 (4.11.0) Build id: 20190314-1200
26

I had a similar problem on my system (Windows 7 pro 64 bit), with Tomcat not starting from any Eclipse version. It turns out that by default Eclipse uses the system network configuration, and if you have configured a proxy that does not resolves localhost the Tomcat startup will hang in Eclipse !

To see if you have this problem go to Window -> Preferences -> General -> Network Connections and see if one of the boxes is checked. I was able to override my proxy configuration by setting Active Provider to Direct (it unchecks all boxes).

1 Comment

Thank you so much! Pfeew! This was driving me crazy.
10

In my case, I had disabled the HTTP/1.1 Connector on port 8080 in favor of an SSLEnabled (https) HTTP/1.1 Connector on port 8443.

I'm not sure if the Eclipse/Tomcat communication was failing because of the wrong port or the wrong protocol, but when I added the HTTP/1.1 Connector on port 8080 back into my server.xml (in addition to the secure connector on port 8443), Eclipse was able to correctly detect Tomcat's successful startup.

It appears that for Eclipse to recognize that Tomcat has successfully started, Tomcat must be configured to have a non-SSL Connector on port 8080.

2 Comments

This is the only solution that worked for me, thanks for sharing it. The downside is that the application is also accessible via HTTP. But of course that seems to be a bug/flaw in eclipse, not in your solution! I'm running Eclipse Neon.2 and Tomcat 8.5.11 by the way, so this is still not fixed in current versions...
I also confirmed that this was the problem in my case. I had commented the line for connector port 8080. I simply wanted the tomcat not to listen on 8080 in favor of some other http server running on same port. I had changed the value of port in the connector from 8080 to 8181 and it worked
7

I was able to fix this issue by doing the following:

  • Right-click on the Tomcat server (under the Eclipse Servers perspective)
  • Select Open - it should open up the xml editor
  • Look for the Timeouts section and increase the value to > 45s

This works with Eclipse Helios / Tomcat 7

1 Comment

although this does not really answer the original question, it did help me in a similar situation (i.e. when I have a break point set that gets triggered during server start up). I needed to temporarily increase the timeout, and it was not obvious how.
5

Ran into same issue here. Tried out all these solutions the others proposed, none of it works for me.

  1. change http 1.1 port to 8090.
  2. add -Djava.net.preferIPv4Stack=true to eclipse.ini (STS.ini in my case).
  3. in Window -> Preferences -> General -> Network Connections, set Active Provider to Direct or Manual.
  4. add 127.0.0.1 localhost to hosts localdns file (C:\Windows\System32\drivers\etc\hosts)

Finally I realized all this happens since I put the tomcat native library in. I removed it and reverted all the changes above, it works now. Anyway, thanks for all your helps which help me connect the issue with the native library.

Comments

5

Well, I tried all these options, I could not get my recent version of STS (Spring Tool Suite 3.7.1.201510041213-RELEASE) to figure out that Tomcat had started.

I tried Tomcat 7.0.64, 8.0.26, 8.0.28. All with the same results. I did get vanilla Tomcat installs to work, so I figured it must a problem with my server.xml (or other file).

So I went through line by line until the server view would stop picking up the started status. Long story short, setting the secure attribute (to any value, like false) on a Connector causes STS to assume that it's another SSL handler.

For example:

<Connector secure="false" executor="conPool" port="8080" redirectPort="8443" protocol="HTTP/1.1" />

Will cause STS to freak out, while:

<Connector executor="conPool" port="8080" redirectPort="8443" protocol="HTTP/1.1" />

Works as intended.

It looks like STS assumes that by merely having the secure attribute, regardless of value, it's an SSL handler. Older versions of STS don't seem to have this problem though. Someone has already filed a very similar bug.

Also note that the server configuration pane shows:

enter image description here

When the server.xml has the secure attribute on a non-SSL connector (and behavior is somewhat wonky), and:

enter image description here

The normal ports listed when it is removed.

Comments

2

I had messed around with my /etc/hosts file and removed the alias that I had set up in Eclipse. So

  1. Go to Window > Show View > Servers
  2. Double click on the Tomcat v7.0 (that's the version I've got)
  3. In the "Host name:" field check that you have a valid alias - if not sure, use localhost or check /etc/hosts or %systemroot%\system32\drivers\etc\hosts

Extending the timeout only delays the inevitable, it fixes the symptom not the cause.

1 Comment

This was my mistake too: an invalid server address
2

Make sure Tomcat is actually listening to 127.0.0.1 when host name is set to localhost.

When starting the Tomcat server in Eclipse the log displays something like:

10:07:23 INFO  main o.a.c.h.Http11NioProtocol Initializing ProtocolHandler ["http-nio-192.168.2.63-8080"]

Your Tomcat server configuration "Host name" and HTTP/1.1 Port MUST resolve to the displayed IP address & HTTP port (in the given example IP 192.168.2.63 Port 8080)

This fixed it with Eclipse 4.5 (Mars) & Tomcat 8

Comments

2

Still facing the same issue after trying all the above solutions. i solved the problem by adding http connector to server.xml. In fact, before fixing the issue, i have only https connector. it seems that eclipse look for tomcat startup by requesting the http url, once removed eclipse can't determine if tomcat is successfully started.

Comments

1

I encountered the same problem. I did all this stuff.

  1. Added all the environment variables in system properties.
  2. Window -> Preferences -> General -> Network Connections turned Active Provider to Manual.
  3. Added -Djava.net.preferIPv4Stack=true after -vmargs in eclipse.ini file.
  4. Increased the timeout from 45 sec.
  5. Updated Eclipse.

Hope this helps.. !!!

Comments

1

This is a very old post yet no one of these solutions worked for me. I had to do a combination of answers in this post and others to get it working. This is what I did;

  • Add 127.0.0.1 localhost to the host file
  • Add -Djava.net.preferIPv4Stack=true to eclipse.ini file
  • Set Active Provider to Manual in Window > Preferences > General > Network Connections
  • Change Host name in Servers (view) > Overview (pane) to computer's network IP.
  • Disable auto reloading in Server (view) > Module (pane) > Module (list item) > Edit (action button)

References

Comments

0

I just noticed that same error here. Eclipse Juno + Apache 7 (7.0.27 and 7.0.29).

The server starts, I can use the application, but stills raising timeout error.

With Eclipse Indigo SR2 it runs correctly. I also noticed that my JAVA_HOME and JRE_HOME variables were deleted (Maybe due some Java Update), so I set the variables again.

Comments

0

I solve this trouble adding

127.0.0.1 localhost

to hosts localdns file (C:\Windows\System32\drivers\etc\hosts), seems that this problem is due to a ipv6 on localhost name.

To understand if this is the problem try to ping localhost and see if it is solved ad ipv4 or ipv6.

Comments

0

Go to Windows --> Preferences --> NetworkConnections --> there is a drop down having three values:

  1. Direct
  2. Manual
  3. Native

By default it is native, so select the manual and click on Apply.

It will work for Eclipse Juno EE with Tomcat 7.

Comments

0

You have to also verify that you are not running a recent version of java jdk ( 1.8 for example ) if it is the case please configure your eclipse to use and older version (1.7 for example ).

Comments

0

For those of you trying to start heavy-loaded application, with a lot of INFO level logging to console. Be aware Eclipse console printer can be confused by amount of data to print and hang Eclipse for a long time, while server actually will be started and can be accessed via browser.

This problem happened to me and took me quite a while to figure out what's happening. I'm running Eclipse Mars and Tomcat 7. In my case app was trying to print all singleton bean names to console, about several thousand bean names thus Eclipse was going crazy.

org.springframework.beans.factory.support.DefaultListableBeanFactory#preInstantiateSingletons

    if (this.logger.isInfoEnabled()) {
       this.logger.info("Pre-instantiating singletons in " + this);
    }

Give it a try, put the app logging level=ERROR. Hopefully this will help someone.

Comments

0

This can also happen, when you set the host name in the server settings to an invalid value.

Comments

0

Looks like Eclipse is verifying Tomcat's running status on :8080.

I had similar problem with Eclipse+Tomcat when I disabled all connectors but one for SSL connections (:8443).

In order to avoid the problem I left both :8080 and :8443 connectors in my server.xml.

Comments

0

EDIT:

Make sure your hostname is "localhost", or if you are using a specific IP address, make sure its the CORRECT IP address that your computer has.

I changed my host name from "localhost" to my specific IP address (at the time). This was to solve an issue I encountered while doing mobile app development.

My problem was that my IP address changed. So updated my hostname to my new IP address. (I will revert it to localhost once I'm done with mobile testing).

Just a heads up, sometimes its a simple fix.

Comments

0

double-clicking Tomcat v7.0 Server at localhost, change 'Host name' to your IP(IPv4). It used to be 'localhost'

Comments

0

I was facing same issue and followed most of the solutions provided but they didn't worked for me.

One of my senior told me the reason for the problem. Previously I created a build for staging environment using mvn clean install -Pstaging, which created a WAR file in the target folder for staging environment. Now whenever I start tomcat it was using the setting from the target to connect to the staging database server and was unable to connect (getting stuck at preparing launch delegate).

Fix: First run mvn clean install in the workspace directory and then in eclipse right click project -> Maven -> Update Project. Now run tomcat.

Comments

0

I encountered this problem today,I followed these instructions above but none worked.Finally I delete my tomcat configurations at Servers tab and renew one and at the Server Locations,I choose "Use workspace metadata(does not modify Tomcat installation)",if these options are grey and can not be changed ,try to change the Server Options below and it will work.


PS:This problem seems having no relationship with the proxy settings,as I choose Native option in Network Connections and use a proxy too. When I changed Server Locations Tomcat no long stuck although the preparing launch delegate in progress tab appeared again.

Comments

0

Go to Control Panel/ Programs / Programs and Features / installed updates, and uninstall the last Microsoft windows update, restart computer, and it works.

Comments

0

Eclipse and tomcat adapter has broken with nio protocol. Change protocol in the port tag in server.xml to protocol="HTTP/1.1".

Comments

0

Double click your server from the left panel and increase time limits

enter image description here

Comments

0

I use a custom protocol handler. It appears that eclipse insists on having a well-known protocol handler. I run on port 8085, so I modified server.xml to have my custom protocol handler on port 8085 and a "dummy" Http11NioProtocol handler on 8086:

<Connector port="8085" protocol="com.company.product.MyProtocolHandler" connectionTimeout="20000" redirectPort="8443"/>
<Connector port="8086" protocol="org.apache.coyote.http11.Http11NioProtocol" connectionTimeout="20000" redirectPort="8443"/>

With just the com.company.product.MyProtocolHandler, Tomcat would not remain up. I now see these two lines in the ports section of my eclipse server configuration:

com.company.product.MyProtocolHandler on port 8086 
HTTP/1.1 on port 8086

Comments

0

Same with me. In my case, the problem would arise and I'd try everything above in different order and combinations. I've tried reinstalling java, reinstalling eclipse, reinstalling Tomcat, creating a different eclipse workspace, setting Tomcat to a different port, trying a clean user on my operating system. I could not identify the cause and solution because it would intermittently fail with the exact same configuration that was working a moment ago. Similarly when trying to fix it, it would magically start working using the same configuration that failed previously. After it started working, I could be productive for a while until the problem would arise again with no apparent cause, and repeat. I've been living with this intermittent problem, at the mercy of the eclipse gods, for YEARS.

In case it is helpful, here's one of the actions that has resulted in a fix for me that is not yet mentioned above.

  1. Disconnect from VPN. Clean Work directory, clean project, rebuild project. Start Tomcat. In my case, with the VPN disconnected it actually started succesfully, with obvious errors that it couldn't see the database etc.

  2. Stop Tomcat. Clean Work directory, clean project, Rebuild project, refresh project directory.

  3. Reconnect to VPN and Start Tomcat.

Comments

-1

my problem turned out i had edited the tomcat install server.xml file for ssl on 8443 and no longer on 8080...eclipse pulls that in and would hang on startup... copied original server.xml and created server over again and all good...i have great aim shooting my own feet...

2 Comments

This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation.
Actually Paul, it does answer the original question which matched my problems symptoms (time outs, reinstall eclipse, ...) so this is an answer for this particular cause...which the earlier answers did not answer...
-3

The problem is definitely with your JDK version. If your are running Windows 7 I would consider changing version of your JDK, and your tomcat version.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.