Why is IntelliJ skipping breakpoints while remotely debugging

allanc picture allanc · May 22, 2015 · Viewed 7.4k times · Source

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?

Answer

vikingsteve picture vikingsteve · May 22, 2015

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.