[hibernate-dev] classloading issue when trying to add envers to as7
Scott Marlow
smarlow at redhat.com
Wed Aug 3 12:56:12 EDT 2011
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).
> 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.
>
> -------------------------
> 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