21

I am debugging some Java code with Eclipse 3.4.2. I have disabled all the breakpoints, yet the debugger still stops at a specific line. This point is several lines before a null pointer exception is triggered. Curiously, when I run the same code/run configuration, but not in the debugger, the null pointer exception does not occur.

Also, if I step through this code from the beginning of the method causing the null pointer exception, using the exact same input, there is no problem. It only occurs when I remove all breakpoints but Eclipse decides to stop there regardless.

Why could this be happening?

Nick Heiner
  • 119,074
  • 188
  • 476
  • 699

3 Answers3

44

I had the same problem and finally found the following configuration option: Windows -> Preferences -> Java -> Debug -> Suspend execution on uncaught exceptions I unchecked it, and the problem disappeared. However, may be it's good to know about uncaught exceptions. I just disabled it because the problem was in Spring framework, not in my code, and hence I could correct nothing... Hope it helps :)

Mendo
  • 441
  • 4
  • 2
18

Eclipse also supports exception break points (which stop your program when a certain exception is thrown). You can see them in the "Breakpoints" panel of the debugger. In your case, this could be a ClassCastException, for example.

If that panel is empty, then it can be a bug in your Java VM or maybe you have two processes open in the debugger. If all else fails, try to debug it in Eclipse 3.5.1.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
4

I've encountered this as well and have yet to find a satisfactory answer. Try doing a workspace refresh, full rebuild and restart Eclipse.

At least one of those suggestions will help.

Failing that - rebuild or restore your workspace (I always keep a backup)

Fortyrunner
  • 12,702
  • 4
  • 31
  • 54