10

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?

allanc
  • 113
  • 1
  • 1
  • 5
  • The only instance where I have seen IDEs skipping breakpoints is where the source code in your console does not match the executable you are running. So the breakpoints you have are never being hit, because they cannot be bound to any real code. – Tim Biegeleisen May 22 '15 at 02:28
  • 1
    Well, I didn't think it was possible. But through a very convoluted path, it turned out that the source did not match. So your observation ended up being the one that fit my problem. – allanc May 23 '15 at 03:14
  • Tim, thanks for your and Steve's replies below. BTW I further figured out that that particular message is associated with the thread that you are stopped in and not a property of your debug setup. Hope your and Steve's replies below help others. – allanc May 23 '15 at 03:16
  • Please mark the response below correct if it solved your problem. – Tim Biegeleisen May 23 '15 at 17:08

1 Answers1

3

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.

vikingsteve
  • 38,481
  • 23
  • 112
  • 156