[hibernate-dev] classloading issue when trying to add envers to as7
Scott Marlow
smarlow at redhat.com
Tue Aug 16 08:32:06 EDT 2011
Strong,
Looks good, nice unit tests also! :)
Scott
On 08/16/2011 12:13 AM, Strong Liu wrote:
> Hello guys,
>
> I just pushed the fix of this issue to my folk, take a look https://github.com/stliu/jboss-as/commit/4f8bce12c6cc90415d697d321442f827287cde1c
>
> as https://docs.jboss.org/author/display/AS7/JPA+Reference+Guide said, there are 3 ways to use hibernate (different version) in AS7
> 1. the default/bundled one, hibernate core 4, in as7
> 2. bundle hibernate jars in app (hibernate-bundled property)
> 3. create a shared hibernate 3 module (with slot 3)
>
> so, here are how to use envers within these 3 cases:
> 1. use bundled envers module, nothing specical needed, just annotate envers annotations to your entity
> 2. bundle envers along with hibernate 3 jars in your app, and set envers listeners (check envers doc)
> 3. create a org.hibernate.envers:main:3 module (not tested yet)
>
> note: you need to use hibernate-core build from source (HHH-6573)
>
>
> -----------
> Strong Liu<stliu at hibernate.org>
> http://hibernate.org
> http://github.com/stliu
>
> On Aug 4, 2011, at 8:35 PM, Scott Marlow wrote:
>
>> On 08/04/2011 04:05 AM, Strong Liu wrote:
>>>
>>> -----------
>>> Strong Liu<stliu at hibernate.org>
>>> http://hibernate.org
>>> http://github.com/stliu
>>>
>>> On Aug 4, 2011, at 2:48 AM, Adam Warski wrote:
>>>
>>>>
>>>> On Aug 3, 2011, at 5:44 PM, 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.
>>>>> 2. org.hibernte.envers module automaticly injected into app when it is a jpa project.
>>>>> 3. org.jboss.as.testsuite.integration.jpa.hibernate.envers.BasicEnversTestCase in as7/testsuite/integration passes
>>>>> 4. use org.hibernate.integrator.internal.ServiceLoader instead java.util.ServiceLoader to load META-INF/services file
>>>>> this custom ServiceLoader uses ClassLoaderService.
>>>>>
>>>>> sounds okay?
>>>>
>>>>
>>>> Great! :) Can't wait to see it in the main repo ;)
>>>>
>>>> I also managed to make an envers module for AS7, as I already described on the forum. What you need is a:
>>>> * new module with the envers jar and following deps:
>>>> <module name="org.hibernate"/>
>>>> <module name="org.jboss.logging"/>
>>>> <module name="org.dom4j"/>
>>>> <module name="javax.api"/>
>>>> <module name="javax.persistence.api"/>
>>>> <module name="javax.transaction.api"/>
>>>> <module name="org.javassist"/>
>>>> * Dependencies: org.hibernate.envers services in your META-INF
>>>>
>>>> What I didn't realize before (and that's why I couldn't make it working) is that the dependencies declaration in the app's meta-inf affects the interaction between modules.
>>>>
>>>> Still the bundled-envers-only-inside-app scenario doesn't work. But I'm not sure it's valid any more, as I've got it working in AS7 and you've done the integration for AS7.1. So do you still need the demo app?
>>>
>>> yeah, that's may not valid anymore, if users want to use hibernate envers 3, it should bundle both hibernate core and envers 3 into app, right, Scott?
>>
>> Some doc on bundling hibernate 3 is included here https://docs.jboss.org/author/display/AS7/JPA+Reference+Guide (contributions to the Confluence doc are easy to make and welcome ;)
>>
>> Some users are starting to experiment with the AS 7.0.1 support for bundling Hibernate 3 for JPA usage. Some are also using the ability to manually create a shared Hibernate 3 module. As of yesterday, I made a slight change to the organization of the Hibernate modules on AS 7.0.1. Rather than including version numbers in the module name, I'm using the AS7 module "slot" mechanism to version the module contents. So, module "org.hibernate" contains a slot (really a sub-folder) named "main" for Hibernate 4 and can contain a slot named "3" for Hibernate 3.
>>
>> In theory, someone could try bundling envers 3 if they are bundling Hibernate 3 with their app. If they are creating their own "as7/modules/org/hibernate/3" sub-folder to hold the Hibernate 3 jars, they could put the jar in there or create a new "3" slot in the envers module folder (would have envers/main for Hibernate4 and envers/3 for Hibernate3). Creating the "3" slot (with contents) is left as an exercise for the user.
>>
>> Strong, have you synced your patch with the AS7 master yet? I restructured things a bit in the last few weeks, to better support multiple persistence providers. A few more changes are needed but the major rework is done. The AS7 jpa source tree, is now broken into core, spi, hibernate3, hibernate4. The Hibernate folders contain integration classes for their respective Hibernate versions. On a private branch, I started creating a generic integration adapter that might be used for other providers (not sure if that will work yet, might need to have provider specific integration classes external to AS7).
>>
>> I probably gave more information than you wanted for the question. :)
>>
>> Scott
>>>>
>>>> Adam
>>>>
>>>> --
>>>> Adam Warski
>>>>
>>>> http://twitter.com/#!/adamwarski
>>>> http://www.softwaremill.com
>>>> http://www.warski.org
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>
More information about the hibernate-dev
mailing list