Hi Jerome,

I've tried out your fix with no success and spent the last couple of days
looking for a solution.  I believe I've finally found a thread on the
Spring-OSGi Google Group that speaks to this exact issue.  

Here's an excerpt from the thread for your reference:

<quote>
It all depends on how the spring bundle uses CGLIB - the exception shown
above occurred inside the Enhancer, which by default uses the classloader
of the target superclass (or its primary interface if no superclass is defined).

In this case this would be your client bundle classloader (which exports the
class that is being enhanced) hence the need to make the CGLIB packages
visible to your bundle.

One solution is for the spring code to extend the Enhancer class and override
the getDefaultClassLoader() method to use a 'chained' classloader that knows
about the client bundle as well as the (spring) framework bundle and delegates
accordingly (either using the package name, or by re-delegate on failure),

ie. the CGLIB classes get provided via spring, so your bundle doesn't have to
know about them - unfortunately this requires a change to the spring internals.

For the time being, importing the CGLIB classes is the simplest workaround. 
</quote>


So, if I'm understanding this quote correctly, the Restlet Spring Extension
bundle unfortunately needs to import the CGlib packages too.  The reason is due
to CGlib's Enhancer class using the ClassLoader of the class that is being
enhanced.  In this case, it is org.restlet.ext.spring.SpringFinder being
enhanced.

Here's a link to the thread I referred to (sorry if it's broken due to 
wrapping):

http://groups.google.com/group/spring-osgi/browse_frm/thread/
d921aaec07c3a5be/41b387ffde4c715b?lnk=gst&q=cglib#41b387ffde4c715b


thanks,
Adam



Reply via email to