Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Import packages in spring dependant bundle question
Import packages in spring dependant bundle question [message #908529] Wed, 05 September 2012 14:26 Go to next message
Vladimir Stevanovic is currently offline Vladimir StevanovicFriend
Messages: 29
Registered: March 2010
Junior Member
Hi,

when importing bundle that has dependency on springframework and hibernate libraries I get java.lang.NoClassDefFoundError org/hibernate/annotations/Entity when spring tries to load class via org.springframework.util.ClassUtils.forName(String name, ClassLoader classLoader) method.

This is because this method is using TCCL that is CL from my bundle and I do not have imported package org.hibernate.annotations in bundle manifest.

This is not happening when classes are loaded in a normal way although packages are not imported in bundle manifest also.

Is this desired behavior?

I would like to avoid very large import packages statement in manifest.

Thanks, Vladimir.
Re: Import packages in spring dependant bundle question [message #911994 is a reply to message #908529] Wed, 12 September 2012 18:42 Go to previous message
Chris Frost is currently offline Chris FrostFriend
Messages: 230
Registered: January 2010
Location: Southampton, England
Senior Member

Hi,

Unfortunately this is just where OSGi classloading clashes with old world classloading. When code uses '.forName' for example using the TCCL then you just have to do the imports on your own bundle. This is not desired behaviour but the only way round the unfriendly classloading in some third party code. You can avoid the large manifest if you really want by boot delegating the packages in the Java profile but be carefully as this may have other side effects especially if other code is also importing the packages.

Chris.


------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
Previous Topic:Virgo packaged Spring 3 bundles not having all dependencies fulfilled
Next Topic:duplicated spring bundles
Goto Forum:
  


Current Time: Thu Apr 25 22:38:30 GMT 2024

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

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

Back to the top