Reputation: 31
I'm developing a eclipse plugin rcp and I'm running into a NoClassDefFoundError
Exception in thread "Thread-7" java.lang.NoClassDefFoundError: org/jdom/input/SAXBuilder at org.geonames.WebService.search(WebService.java:783) at geo.GeocoderGeonames$SearchThread.run(GeocoderGeonames.java:119) Caused by: java.lang.ClassNotFoundException: org.jdom.input.SAXBuilder at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:483) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:399) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:387) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) ... 2 more
The class that supposedly cannot be found is in a jar that I have added to the buildpath. I don't get any compile error etc only this exception when the running application enters the code where this class is needed...
Is there some other place I need to add the jar
Upvotes: 0
Views: 2292
Reputation: 31
After reading this added the jar to the MANIFEST.MF, which solved the problem. As I understand it, eclipse starts several classloaders which only sees what MANIFEST.MF tells them to see and ingnores the build path...
Upvotes: 1
Reputation: 23655
In our experience a NoClassDefFoundError
can sometimes mean that more than one version of a Class are found, as there is also a ClassNotFoundException
that's normally thrown if a class cannot be found.
Another reason in your case (XML parser) might be something with endorsed classes. Are you directly importing the jdom classes or something like org.w3c...? If so, have a look at the "endorsed classes" system of Java, something that I just recently came across.
Upvotes: 0
Reputation: 13852
How are you running your plug-in? You may need to add the JAR to the class path in the VM arguments.
Upvotes: 0