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,
org.eclipse.core.runtime,
org.eclipse.core.databinding;bundle-version="1.4.0",
org.eclipse.core.databinding.beans;bundle-version="1.2.100",
org.eclipse.jface.databinding;bundle-version="1.5.0",
org.eclipse.core.databinding.property;bundle-version="1.4.0",
org.eclipse.ui.navigator;bundle-version="3.5.101",
org.hibernate.eclipse.libs;bundle-version="3.5.1"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6

And build.properties like this:
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
icons/,\
splash.bmp,\
plugin_customization.ini,\
product_lg.gif

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(AnnotationConfiguration.java:740)
[...]
at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
[...]
at com.quietbus.flt.Application.start(Application.java:40)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
[...]
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: java.lang.ClassNotFoundException: com.quietbus.flt.model.City
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
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(ReflectHelper.java:192)
at org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(AnnotationConfiguration.java:737)

[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:Problems in accessing c++ pointers in Eclipse
Next Topic:[ERROR]An error occurred while automatically activating bundle
Goto Forum:
  


Current Time: Fri Nov 28 06:00:57 GMT 2014

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

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