Debugging missing or ignored OSGi bundles

Developing your own Eclipse RCP plugin (or any other OSGi bundle, since Eclipse is also just yet another bundle) can be as exciting as frustrating, the latter especially when things go wrong and you just can’t figure out why.

I just experienced the following faulty behavior whilst coding a new RCP plugin:

  • Running as an Eclipse application the plugin worked just fine
  • I did something codewise I couldn’t recall
  • Running as an Eclipse application didn’t actually fail after that but it also showed no trace of my bundle being loaded at all in the first place

Debugging showed no result either, even breakpoints in the Activator class had no effect. There was no trace of the bundle being started, no exception had been thrown, even desperately inserted printline-messages wouldn’t show.

The actual problem was a NullPointerException somewhere in my previously added code that caused my bundle to fail, but as I learned, Eclipse stops and quits faulty bundles – kind of before they’re actually executed? I couldn’t explain properly, yet this caused the missing debug information.

If you experience something similar, here’s the quick & simple solution: Choose Run Configurations and add -noExit to the Program Arguments. That will prevent the faulty bundle from being stopped and you can actually see the important exception notifications.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s