Menu

#371 OSGi integration is broken

Dozer v5.3.3
open
nobody
5
2012-04-17
2012-04-17
Anonymous
No

org.dozer.util.DefaultClassLoader.loadClass(String className) tries to load classes with default classloader, which is incorrect in OSGi environment and causes ClassNotDefFound exceptions.

What is funny, it actually happens when DefaultClassLoader tries to load another DefaultClassLoader.

To fix it you need to replase
result = ClassUtils.getClass(className);

with
result = ClassUtils.getClass(this.getClass().getClassLoader(), className);

Actually using classloaders are not recommended:
http://www.osgi.org/blog/2011/05/what-you-should-know-about-class.html

but this fix at least make dozer work under OSGi environment.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB