Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is IntelliJ skipping breakpoints while remotely debugging

I have been asked to debug a Java application installed in Apache Karaf (OSGi) running in a VM hosted on my dev machine. My colleague has been able to do remote debugging successfully using Eclipse. My tool of choice is IntelliJ and in my attempts to debug remotely, IntelliJ connects successfully (via socket). If I pause the debugging session, the Karaf console freezes as expected and resumes when I click continue. But when I am paused I can see the following message in IntelliJ and my breakpoints are ignored.

Target VM is not paused by breakpoint request. Evaluation of methods is not possible in this mode.

What does this mean? I have searched and also gone through the documentation for IntelliJ. Why can Eclipse allow working breakpoints and IntelliJ doesn't?

like image 878
allanc Avatar asked May 22 '15 02:05

allanc


People also ask

How do I keep break points in IntelliJ?

Manage breakpoints To do this, go to Settings/Preferences | Build, Execution, Deployment | Debugger and select Drag to the editor or click with middle mouse button. Clicking a breakpoint will then enable or disable it.

Why my debugger is not working in IntelliJ?

If the code is outdated, or the versions (the source code and the compiled class) mismatch in any way, it can happen that the debugged is giving the IDE information to show a certain line, but that information is not correct giving the current source code, which might cause what appears to be the debugged "jumping" ...

How do I Debug faster in IntelliJ?

Turning off the setting Enable toString() data views solved this problem of slow debugging. Incase you are experiencing slow debugging issues on IntelliJ, do make sure that this setting is turned off.

Why is IntelliJ debugger so slow?

Debugger performance can be affected by the following: Method breakpoints will slow down debugger a lot because of the JVM design, they are expensive to evaluate. Remove method breakpoints and consider using the regular line breakpoints. To verify that you don't have any method breakpoints open .


1 Answers

Firstly, one presumes that you have started up your OSGI container (for example, Fuse Fabric) in debug mode. Often this is done by adding the argument debug to the start script.

For example:

c:\> startfabric.bat debug

As Tim noted, you just now need to make sure that your source code is exactly synced with whatever is deployed to the OSGI container.

To be sure, check out the exact same source code version as what is deployed to the server, and choose Build -> Rebuild Project. If necessary, do a mvn clean install on your machine, and deploy a bundle / feature that you have built yourself - then you know that the code you have locally should exactly match what is deployed.

Lastly, check your debug panels in IntelliJ, and remove any Watch expressions that might be interfering whilst in debug mode.

like image 101
vikingsteve Avatar answered Oct 18 '22 22:10

vikingsteve