Debug OSGi from within an application?

I'm working on a project that is gradually trying to move over to a more modular codebase.  One of the technologies we're using for that is OSGi.  After the application's main class is loaded (along with a lot of other non-modular code), an OSGI bundle manager class takes care of loading bundles and then other code uses that.  And then user inputs generate calls into the services provided by the bundles with data from the application.

I am trying to figure out if there's any way for me to run a debug configuration from within IntelliJ that allows me to debug into the loaded OSGi plugins.

Currently, if I use a Run/Debug and debug start my program, the OSGi bundle classes are unable to be loaded/found.  So in order to accomplish what I want I'm having to launch the program separately from the IDE and use the Remote Debug configuration instead.  This is sort of a pain and I was hoping to get back to simply hitting "Debug" to develop my app.

I have seen information about Osmorc and tried going down that road (since I'm using IDEA 10) but it does not seem to provide me with a way of specifying a "main" class that will run that will eventually load the bundles.  To me, Osmorc looks more like a JUnit type of technology that is built for OSGi.  

If I wanted to just test the individual methods on the interfaces in my bundle, this probably would be fine.  But I need to run the main application (that happens to load OSGi bundles during its execution) and I need to debug into the bundles it loads so I can breakpoint when the calls are made from within that application.

Any help would be appreciated.

Thanks,
- Mark

Please sign in to leave a comment.