I've been struggling with this one for a few days now, hopefully someone can help.
I'm getting the following error when my application tries to build my Hibernate3 SessionFactory:
...
org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml
...
Caused by: org.dom4j.DocumentException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory Nested exception: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
...
Below is my /WEB-INF/jboss-web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<loader-repository>some.unique.package.name:archive=lvs.war
<loader-repository-config>java2ParentDelegation=false</loader-repository-config>
</loader-repository>
</jboss-web>
Hibernate works fine in my unit tests, it's only when I deploy it to the test server that this happens.
From what I've found, this appears to be happening because jboss already has a copy of dom4j.
No I can't remove dom4j from my project, web-apps on the server it will be hosted on are expected to use all their own jars.