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.
Chris Frost Messages: 222 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.