Best way to debug OSGI bundles in Karaf

Randy Leonard picture Randy Leonard · Jun 9, 2015 · Viewed 7.8k times · Source

To date, I've been successful at building OSGI bundles, and invoking web services defined in these bundles via Apache CXF. Next, I'd like to be able to set breakpoints in my bundles as they are executed within the Karaf environment.

I've looked into EIK, but it doesn't seem that project has been active in a while? And the compatibility page indicates the latest Eclipse version for which it is compatible is Juno.

I've also come across the following quote on StackOverflow from when the EIK project seemed to be last active:

The Karaf team is now also working on a better integration with EIK, but at the current time it's not yet as deeply integrated as it would be needed (see the related issue)

What is the best way to debug OSGI bundles running in Karaf 3.0.3 or Karaf 4.0.0 M3 using Eclipse?

Answer

Jorge Martinez picture Jorge Martinez · Jun 10, 2015

The best way for me is to use the debug option when launching Karaf. This allows you to perform remote debugging ( I have done it from Eclipse and Intelli J with no problems). Just make sure your source is up to date with the karaf instance you are running. See this for more info: