[hibernate-dev] classloading issue when trying to add envers to as7
Strong Liu
stliu at hibernate.org
Thu Aug 4 06:14:20 EDT 2011
On Aug 4, 2011, at 12:56 AM, Scott Marlow wrote:
> On 08/03/2011 11:44 AM, Strong Liu wrote:
>> Hi there,
>>
>> I get envers embedded into as7 :D
>>
>> see below:
>>
>> https://github.com/stliu/hibernate-core/tree/classloading
>> https://github.com/stliu/jboss-as/tree/as7-928-2
>>
>> 1. org.hibernate module and org.hibernate.envers module depends on each other.
>
> We might make the Hibernate to envers dependency optional in the org.hibernate module.xml:
> <module name="org.envers" optional="true"/>
> So, that it is possible for the envers module to be removed for some reason (I cannot think of why at the moment but just a thought).
okay
>
>> 2. org.hibernte.envers module automaticly injected into app when it is a jpa project.
>
> This is where it gets tricky to package envers with the app. Have you synced up with AS7 (7.0.1) master yet? I have another change coming that could impact yours (in queue waiting to be merged).
>
> Anyway, start with packaging envers as a standalone module and try bringing a envers test into the as7/testsuite/compat/* based on the current embedded test (there are only two tests and one is @Ignored).
>
>> 3. org.jboss.as.testsuite.integration.jpa.hibernate.envers.BasicEnversTestCase in as7/testsuite/integration passes
>
> Nice work! :-)
>
>> 4. use org.hibernate.integrator.internal.ServiceLoader instead java.util.ServiceLoader to load META-INF/services file
>> this custom ServiceLoader uses ClassLoaderService.
>>
>> sounds okay?
>>
>> Scott, question, if there is envers.jar embedded in app too, will app class loader see it before the envers.jar in org.hibernate.envers module?
>
> As mentioned above, special care is needed to avoid having two envers classloaders in the app deployment. We might have to make further changes to not inject envers into the app, if the app already has its own hibernate + envers.
I think there are 3 use cases:
1. hibernate core 4 and envers 4 in as7 -- as default, done
2. hibernate core 3 and envers 3 bundled in app
as list in [1] (Packaging the Hibernate 3.x JPA persistence provider with your application)
if (hibernate3-bundled property is defined)
do not add default envers module to app dependencies set
}
3. hibernate core 3 and envers 3 in as7 separate module
create hibernate core 3 module as [1] (Sharing the Hibernate 3.x JPA persistence provider between multiple applications)
create hibernate envers module with slot 3 ??
[1] https://docs.jboss.org/author/display/AS7/JPA+Reference+Guide
>
>>
>> -------------------------
>> Best Regards,
>>
>> Strong Liu<stliu at redhat.com>
>> http://about.me/stliu/bio
>>
>>
>>
>> On Aug 3, 2011, at 6:25 PM, Strong Liu wrote:
>>
>>>
>>> Begin forwarded message:
>>>
>>>>
>>>> Adam,
>>>>
>>>> can you send your test app to me?
>>>>
>>>> use cases:
>>>>
>>>> 1. envers and hibernate core in as7
>>>> 2. envers jar in app, and hibernate core in as7
>>>> 3. envers and hibernate core in app
>>>>
>>>> #1 is almost done, just need some code clean up
>>>> (Scott, we missed services="import", that's why ClassLoaderService can't find resource in envers/META-INF/services)
>>>
>>
>
More information about the hibernate-dev
mailing list