Description
We need CGLIB to reside in Tomcat's common/lib Classloader due to Hibernate-Issues.
In this case, there is a ClassNotFoundException from CglibProxiedPropertyChangeObserverImpl.observePropertyChanges().
This is, because net.sf.cglib.proxy.Enhancer's static create-method falls back on the classloader, in which it is loaded. The correct behaviour, imo, would be to make the enhancer use the thread-context-classloader.
Proposed patch (tested, works well):
In o.a.t.record.CglibPropertyChangeInterceptor change the lines (90ff):
_________________
Object ret = Enhancer.create(property.getClass(), interfaces,
new ObservableMethodFilter(),
new Callback[]
);
_______________
into:
______________________
Enhancer e = new Enhancer();
e.setClassLoader( Thread.currentThread().getContextClassLoader() );
e.setSuperclass(property.getClass());
e.setInterfaces(interfaces);
e.setCallbackFilter(new ObservableMethodFilter());
e.setCallbacks(new Callback[]
);
Object ret = e.create();
________________________