Posted by: Brian de Alwis | February 14, 2011

ClassNotFoundException with OSGi/Eclipse bundles

Today my JUnit Plugin tests decided to go on strike and throw ClassNotFoundException exceptions rather than run my master test suite. Although I was fairly confident in the small changes I had made couldn’t have ruined anything, I preferred confirmation from JUnit’s green bar.

After an hour of cursing, enabling all manner of debugging and tracing options on org.eclipse.osgi, and finally stepping through the classloader (not fun at all), I discovered that the test bundle’s BundleData had an empty classpath. Bingo! Adding the following single line to the MANIFEST.MF solved the issue:

  Bundle-ClassPath: .

Although I understand the necessity of this line, I’m at a loss to explain why my tests have been running perfectly well for the last several months.



  1. where is that MANIFEST.MF??? is it in bundlefile jar ?

    • Yes: OSGi manifests are a superset of the Java META-INF/MANIFEST.MF

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