Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse skipping breakpoints

My issue isn't a new one, and I found several threads about it, yet no one was helpful for me. I hope this one will.

I can't debug with eclipse. It recognizes breakpoints, switches to debug view, but somehow it gets out of sync and I can't debug my code. Sometimes It works, but after a while It happens again.

I work with JDK 1.6.0_24, Glassfish 3.1, eclipse INDIGO (but it also happens on HELIOS).

I tried (as I found in this site) to set eclipse to use Parallel GC. I tried put it in the eclipse.ini file, I tried to put in the glassfish VM arguments itself, and I tried to put it at eclipse JDK additional VM arguments (preference -> installed JRE-> JDK -> etc). Nothing seem to work for me. I also tried them all together.

Help me please..

Thank you all from advance, Ido



EDIT:

OK, I noticed few more things:

On the Debug view, in my stck trace, I found the exact class with the breakpoint is paused and it had this comment: "(Suspended breakpoint at line XX)". When I clicked the line, suddenly the green line appeared. Yet, as soon as I clicked F6 to continue, It went out of sync again, just the next line became suspended. Weird.

I checked the processes running on my computer and found that there are several "java.exe" processes running at the same time. (eclipse runs on javaw.exe). Maybe this is why glassfish and eclipse refuse to work together.

I checked the build path and found that this is my output folder: project-name/target/classes. Is this good?

Any thoughts?

Ido

like image 340
Ido Barash Avatar asked May 21 '12 12:05

Ido Barash


People also ask

What is skip all breakpoints in eclipse?

Select the Skip All Breakpoints command [ ] to mark all breakpoints in the current view as skipped. Breakpoints marked as skipped will not suspend execution. The Breakpoints View showing all breakpoints marked as skipped.

What happens when you execute the run -> skip all breakpoints command?

The command icon is highlighted when all breakpoints will be skipped. To restore default behavior, i.e. break the application at all enabled breakpoints, run the command again. (The command is a toggle.)

How do I toggle breakpoints?

You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint.


2 Answers

So, I couldn't fix this but I found a workaround that completely solves this - FINALLY!.

I just stopped using glassfish WTP for debugging and set a remote debug to my local glassfish. it works perfectly with few minor annoying things - but breakpoints finally noticed.

Set remote debug

  1. Go to your glassfish admin console and set your glassfish to work on debug mode.
    Click on configuration --> server-config --> JVM settings, and check debug enabled check box.
    Restart server

  2. In eclipse - start server on normal mode (not debug - it is useless).

  3. Go to Debug configurations and locate "Remote Java Application"

  4. Create a new Remote java app debug config

  5. Enter name (lets say Glassfish-Debug)

  6. Choose project to debug

  7. Enter your own IP address in the host section and set the port to 9009
    enter image description here

  8. This is optional but it is more comfortable to work with:
    Go to "Common" tab, and check the Debug check box.
    This will make this Glassfish remote debugging configuration constant on your debug menu.
    enter image description here

That's it. Now all you have to do is always start your Glassfish in normal mode and then go to Debug configurations and run This Glassfish remote debugging you just set.
enter image description here

And now I'm getting to the annoying part: After rebuild your project, sometimes you might get again out of sync. You just need to disconnect the remote debugging session and run it again. Small price to pay.

I hope it helps..

like image 137
Ido Barash Avatar answered Sep 28 '22 11:09

Ido Barash


I had faced similar issues, But it turned out to be a simpler problem of multiple versions of JREs/JDKs installed.

Try Debug -> Run Configuration -> JRE -> Alternate JRE -> select JDK 1.6.0_24.

Also check for project build paths if correct Jars are been used.

Hope this helps.

like image 25
Sachin Bhansali Avatar answered Sep 28 '22 11:09

Sachin Bhansali