简体   繁体   中英

Jboss-4.2.3 Seems to be ignoring jboss-web.xml

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.

Try to change / check value for your server configuration.

In server/xxx/deploy/jboss-web.deployer/META-INF/jboss-service.xml
there are two attributes to try

  • Java2ClassLoadingCompliance
  • UseJbossWebLoader

Both are boolean values and control some class loader behaviour.

HTH.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM