46

Running Tomcat through eclipse works fine in non-debug mode, but not in debug mode. When I try to start the Tomcat server in debug mode, the console output looks fine for a while, but then starts slowing down and eventually just stops, pegging the cpu at 100%. I don't think it's relevant, but just in case - here's the console output right about when it starts slowing down and eventually stopping (by stopping I mean no more console output, but still 100% cpu).

2009-09-02 14:35:30,859 INFO   NONE org.springframework.context.weaving.DefaultContextLoadTimeWeaver:72 - Found Spring's JVM agent for instrumentation
2009-09-02 14:35:49,562 INFO   NONE org.springframework.beans.factory.support.DefaultListableBeanFactory:414 - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@ed889d: defining beans [...
2009-09-02 14:37:31,031 INFO   NONE org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean:221 - Building JPA container EntityManagerFactory for persistence unit ...

I tried everything I could think of to fix it:

  • cleanesd tomcat working directory
  • restarted eclipse
  • restarted Windows
  • refreshed/cleaned all projects

I first had this problem last week using eclipse ganymede. I had been running fine in debug-mode for several months prior to this issue. I didn't make any significant changes to our project that would cause this. Eventually, I upgraded to eclipse galileo which solved my problem. Now 2 days later, I'm having the same problem in galileo. Like I said it works fine in non-debug mode. Any help is much appreciated.

I should add that other things work in debug mode - for instance junit tests, so it is something specific to tomcat.

thejartender
  • 9,339
  • 6
  • 34
  • 51
andersonbd1
  • 5,266
  • 14
  • 44
  • 62
  • Did you try to cleanup your workspace. Sometimes it happens to me, then I'll just clean my workspace. Once the workspace is cleaned it works fine – Arun P Johny Sep 03 '09 at 12:06
  • FYI - this same applies to Intellij IDEA. Just tried this with IntelliJ 10 and i went from 7 minutes startup time for tomcat 5.5.31 to 20 seconds for my app.... – Shaun Jun 21 '12 at 01:13

5 Answers5

143

I've gotten through the issue! Once I figured it out, I remember that this has happened before. I cleared all my breakpoints and it works fine. I have no idea why that would cause the outcome that is does, but it works.

andersonbd1
  • 5,266
  • 14
  • 44
  • 62
  • Happened to me too and cleaning breakpoints helped.. It's weird though.. :) – kane77 Apr 20 '10 at 08:21
  • 5
    **Thank you so much!!!** We should seriously get this listed as an " [Eclipse bug](https://bugs.eclipse.org/bugs/) " (or whatever might be appropriate) so that it doesn't slow any more developers down! – blong May 17 '11 at 19:47
  • 1
    Just ran into the same problem in Eclipse Helios ...deleting the breakpoints fixed the issue, thanks!!! – hugri Aug 26 '11 at 08:58
  • Thanks! Is there a bug filed for this issue? – Marco Feb 08 '12 at 20:55
  • 2
    Thanks! You saved lots of time and money for me and my company. – kolobok Nov 28 '13 at 15:44
  • 2
    Same here. Thanks a lot! My startup slow down when the JPA Hibernate EntityFactory was loaded. Before that. All good and fast. Version: Kepler Service Release 2 Build id: 20140224-0627 – feder Dec 22 '14 at 22:05
  • 1
    MVP, thank you! I don't remember that happening to Netbeans, is this problem common in other IDEs? – Alberici Feb 24 '15 at 13:23
  • After every statement server will check with debugger if breakpoint is hit - hence depends on number of breakpoint and network speed. – Amit G Feb 18 '16 at 08:27
  • I worked with intellij, however it's my solution! @andersonbd1, I verified everything from tomcat, hibernate to network, but I didn't attention to breakpoints even for a second. Anyway, Thanks! – Arman Jun 28 '16 at 09:49
  • Thank you. I was having the same problem since yesterday. – Anika Sep 28 '18 at 11:46
  • This resolved the issue for me on Eclipse Photon, JDK 8, Tomcat 8.5. Thanks! – Asencion Apr 05 '19 at 16:55
21

I just ran into this problem myself, and this solution helped me out. However - I only had 1 breakpoint, rather than the 20+ of other posters. My one breakpoint, however, was a method breakpoint and not a line breakpoint - I wonder if the multitude of method calls at tomcat startup combined with the method breakpoint could be causing this problem... I just tried a small experiment:

  1. Setting a line breakpoint and starting debug mode - 5 second startup (normal)
  2. Setting a method breakpoint and starting debug mode - ..... not willing to wait (> 90 seconds).

I'm guessing this is the problem.

Chris Goddard
  • 211
  • 2
  • 3
  • 4
    Yes, method breakpoints and watchpoints (breakpoints on fields) are much, much slower than line breakpoints. Favor line breakpoints wherever possible, unless you're not sure the source you have matches up with the class you're debugging. For example, put a breakpoint on the first statement inside of a method instead of on the method signature itself. See http://stackoverflow.com/a/787753/277307 for insight into why method breakpoints are slower. – John McCarthy Feb 29 '12 at 23:27
  • Thanks @nodescript1 I know the reason that why my eclipse slow and fix it. – Mr Lou Apr 27 '12 at 02:20
3

I too stumbled upon this issue.

I closed all the irrelevant projects. Cleared out my breakpoints. Increased STS VM memory. Follow this blog: http://searchforsolutions.wordpress.com/2011/12/01/eclipse-jvm-settings-for-optimized-performance/ Disabled the JBoss tool validators and all other validators.

Now STS works like a charm!

AdrianRM
  • 2,622
  • 2
  • 25
  • 42
Rohitdev
  • 866
  • 6
  • 15
3

I had this same problem in Eclipse Galileo. Fast run but crawling debug. Thanks to the posts above, I cleared all the breakpoints and restarted Tomcat. That magically fixed the problem. fyi - I had 2 method breakpoints and other line breakpoints earlier. I did the tests to confirm the above theory about method breakpoints slowing down. Here's what I found. Looks like it's not the method breakpoint which is the problem, the problem was the method breakpoint which was still showing up in the breakpoints list in debug view, but was not existing in the code. I mean I changed the parameters of that method but the old breakpoint with older parameters was still existing in the breakpoint list. That was the culprit, when I removed that, the other method breakpoints did not slow down the server. So looks like Eclipse was trying to search for something non-existing which seems to have slowed it down. Hope this helps.

bluish
  • 26,356
  • 27
  • 122
  • 180
vsc
  • 31
  • 1
0

Change default logging level from:

<root>
  <level value="DEBUG" />
  <appender-ref ref="ConsoleAppender" />
</root>

To :

<root>
  <level value="OFF" />
  <appender-ref ref="ConsoleAppender" />
</root>
Jamal
  • 9
  • 1