[hibernate-dev] classloading issue when trying to add envers to as7
Scott Marlow
smarlow at redhat.com
Thu Jun 16 08:00:00 EDT 2011
FYI, I'm on pto for a few days (family medical issue).
I'd like to help you further with this but think it should just wait
until next week.
Scott
On 06/16/2011 07:54 AM, Strong Liu wrote:
> Hi there,
>
> first of all, I have finished this task, and test pass.
> but :), i have to make the following changes, i'd like to hear you guys' thoughts before i go to much away.
>
> 1. adding envers into org.hibernate module in as7, so user's app can see both hibernate and envers class
> (with an separate envers module i ran into some cycle dependency issue)
>
> 2. envers throws "listeners were not registed" exception, means hibernate's IntegratorServiceImpl can't see envers class/resource
>
> IntegratorServiceImpl is using java.util.ServiceLoader#load(Class<S> service), which internally using TCCL, (I think)
> that's the reason why core can't see envers' integrator.
>
> so, i created a custom ServiceLoader which use ClassLoaderService to find the integrator, but this doesn't work either.
> since, we need org.hibernate.service.classloading.internal.ClassLoaderServiceImpl#locateResources first (META-INF/services/org.hibernate.integrator.spi.Integrator) and ClassLoaderServiceImpl using resourceClassLoader to do this.
> by default, resourceClassLoader is set to applicationClassLoader in ClassLoaderServiceImpl.
>
> then, i changed IntegratorServiceImpl to use java.util.ServiceLoader#load(Class<S> service, IntegratorServiceImpl.class.getClassLoader()
> ), test pass, but this of course is not the fix.
>
> so, i changed the custom ServiceLoader to use classLoaderService to locateResources first, and using ServiceLoader.class.getClassLoader() to reload the resource again.
>
> here are the changes:
> https://github.com/stliu/hibernate-core/commit/09ce5defabea8cfb87d06c3d7b9bc1a2c613f62c
> https://github.com/stliu/jboss-as/commit/616237755626672157fb2ae565fadb16cf47af89
>
> thoughts?
>
> -----------
> Strong Liu<stliu at hibernate.org>
> http://hibernate.org
> http://github.com/stliu
>
More information about the hibernate-dev
mailing list