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

Scott Marlow smarlow at redhat.com
Tue Aug 2 09:41:06 EDT 2011


It is probably easier to integrate the Envers as a standalone module 
that depends on the AS7 "org.hibernate" module.  The "org.hibernate" 
module needs to depend on "envers" as well (to satisfy the circular 
dependency).  We should at least try to do it that way.  Strong had run 
into difficulty with creating the patch (I'm not sure what exactly since 
I got busy with other stuff when he was doing this).

On 08/02/2011 09:11 AM, Adam Warski wrote:
> As a follow-up, I tried adding Envers to a web application deployed on AS7 today, using Hibernate provided with the AS.
> I got some class loading problems though with dom4j. See the forum discussion:
>
> http://community.jboss.org/message/618823#618823
>
> I also tried creating a separate Envers module which would depend on org.hibernate, but the Hibernate doesn't seem to see the Envers Integrator.
>
> Strong Liu: isn't it something you've prepared a patch for? I don't think it was included?
>
> Adam
>
> On Jun 21, 2011, at 8:23 AM, Adam Warski wrote:
>
>>
>> On Jun 20, 2011, at 7:56 PM, Scott Marlow wrote:
>>
>>>>
>>>> and adding envers into org.hibernate module, means there will no org.hibernate.envers module, and a (jpa) app's classloader can access org.hibernate module, right? so it can access envers class too.
>>>
>>> Wrong, just adding envers to org.hibernate (either via a module dependency or the jar directly) doesn't result in envers being exported from the org.hibernate module.  There is an option to do that, if so desired (via the export="true").  The better option is knowing whether or not it is needed and dynamically injecting envers only if it is.
>>
>> Not sure how it works exactly, but I suppose that if the application declares somehow that it uses Envers, only then the Envers module should be visible? Looking at the dependencies tree between Hibernate modules, Envers is a leaf, so in theory it should be doable ;).
>>
>>>  From what you previously said, I think the dependencies are:
>>>
>>> - Application classes may reference the envers annotation.
>>>
>>> - Application classes may reference Hibernate classes.
>>>
>>> - Hibernate core may reference envers.
>>>
>>> - Hibernate envers may reference Hibernate core.
>>>
>>> Sound right so far?
>>
>> Well Core doesn't reference Envers in any way.
>>
>> Envers aside, I think the Integrators should work anyway. Say a user creates his own Integrator and puts it as part of the application classes - will Hibernate see it on startup? The same applies to Envers - Hibernate should see the integrator if the module is enabled.
>>
>> --
>> Adam Warski
>>
>> http://twitter.com/#!/adamwarski
>> http://www.warski.org
>> http://www.softwaremill.eu
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>




More information about the hibernate-dev mailing list