Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » org.eclipse.osgi.internal.loader.BundleLoader not seeing class in src folder(ClassNotFoundException)
org.eclipse.osgi.internal.loader.BundleLoader not seeing class in src folder [message #1007210] Tue, 05 February 2013 01:09 Go to next message
Paul Morris is currently offline Paul MorrisFriend
Messages: 9
Registered: December 2011
Junior Member
I'll preface by saying I am experienced in Java but not in PDE. I'm loading a hibernate.cfg.xml in a static method at startup but it can't find a class in my classpath. I thought it to be a Hibernate issue but the stack trace indicates that it's caused by BundleLoader throwing a ClassNotFoundException. I'm not 100% sure what in my build would be relevant but I'll start with this:

The hibernate config file is loaded in a static method like this:
URL url = Platform.getBundle("com.quietbus.flt").getResource("hibernate.cfg.xml");
sf = new AnnotationConfiguration().configure(url).buildSessionFactory();

My MANIFEST.MF looks like this:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: FLT
Bundle-SymbolicName: com.quietbus.flt; singleton:=true
Bundle-Version: 0.9.0
Bundle-Activator: com.quietbus.flt.Activator
Bundle-Vendor: QUIETBUS
Require-Bundle: org.eclipse.ui,
Bundle-RequiredExecutionEnvironment: JavaSE-1.6

And like this:
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\

I've tried all sorts of adjustments to the plugin.xml settings based on Googling over the past two days but it just baffles me that the class under src (and getting exported to bin... I checked) is not found.

Here is the abridged stack trace:
org.hibernate.MappingException: Unable to load class declared as <mapping class="com.quietbus.flt.model.City"/> in the configuration:
at org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(
at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(
at com.quietbus.flt.Application.start(
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
at org.eclipse.equinox.launcher.Main.main(
Caused by: java.lang.ClassNotFoundException: com.quietbus.flt.model.City
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(
at org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(

[Updated on: Tue, 05 February 2013 01:10]

Report message to a moderator

Re: org.eclipse.osgi.internal.loader.BundleLoader not seeing class in src folder [message #1007407 is a reply to message #1007210] Tue, 05 February 2013 18:40 Go to previous message
Paul Morris is currently offline Paul MorrisFriend
Messages: 9
Registered: December 2011
Junior Member
Updating this myself. I tried moving the classes that hibernate needs to see to another plugin (call it the model plugin) and then exporting those packages from the model plugin. Then I added the model plugin as a dependency to the ui plugin where hibernate is but hibernate still can't see the model classes. It seems that the class loader that hibernate's AnnotationConfiguration is running in is not aware of what's loaded by the ui plugin. Looked into buddy policy and that didn't help since I can't control the buddy policy of Hibernate's plugin.
Previous Topic:[ERROR]An error occurred while automatically activating bundle
Next Topic:Using Eclipse folding & projection to hide some portions of text (not an entire row)
Goto Forum:

Current Time: Fri Apr 20 22:30:01 GMT 2018

Powered by FUDForum. Page generated in 0.01558 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software