1 2 3 Previous Next 31 Replies Latest reply: Aug 3, 2011 11:14 PM by jaikiran pai RSS

Trying to use Envers with AS-provided Hibernate

Adam Warski Master



I'm trying to deploy an application that uses Envers into AS7 and use the Hibernate included. (If I bundle Hibernate with my app it works fine). The problem is dom4j: Envers uses that and passes some dom4j classes to Hibernate. So I can't bundle it in the .war. I tried adding a Depends: org.dom4j to the manifest, but then I get:


Caused by: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory

          at org.dom4j.DocumentFactory.getInstance(DocumentFactory.java:97)

          at org.dom4j.DocumentHelper.getDocumentFactory(DocumentHelper.java:36)

          at org.dom4j.DocumentHelper.createDocument(DocumentHelper.java:41)

          at org.hibernate.envers.configuration.RevisionInfoConfiguration.generateDefaultRevisionInfoXmlMapping(RevisionInfoConfiguration.java:86)


Which would suggest again a classloading issue. There's only one copy of the dom4j jar, but I suspect the classloader used for Hibernate-core and its dependencies is different from the one used for Hibernate-envers and its dependencies, am I right? Any ideas?




1 2 3 Previous Next