[hibernate-dev] classloading issue when trying to add envers to as7

Scott Marlow smarlow at redhat.com
Thu Aug 4 08:35:58 EDT 2011


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