0 Replies Latest reply on Oct 25, 2012 5:40 AM by Yann Le Moigne

    jboss-deployment-structure.xml and ear lib classes exclusion

    Yann Le Moigne Newbie

      Hi,

       

      I have an ear with the following structure :

      myapp.ear

      \ejbJar1.jar

      \ejbJar2.jar

      \lib\jpaModule.jar

      \lib\org.eclipse.birt.runtime-4.2.0.jar

       

      The jpaModule.jar contains an META-INF/orm.xml

       

      The problem is, hibernate use dom4j to load the orm.xml

      The org.eclipse.birt.runtime-4.2.0.jar unfortunatly contains org.dom4j classes.

       

      So I have a class cast exception :

      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

          at org.dom4j.io.SAXReader.read(SAXReader.java:484)

          at org.hibernate.internal.util.xml.MappingReader.readMappingDocument(MappingReader.java:76)

       

      I'm trying to tune classloading by adding in ear/META-INF/jboss-deployment-structure.xml with this :

      <?xml version="1.0" encoding="UTF-8"?>

      <jboss-deployment-structure>

          <deployment>

              <resources>

                  <resource-root path="lib/org.eclipse.birt.runtime-4.2.0.jar">

                      <filter>

                          <exclude path="org.dom4j.*" />

                      </filter>

                  </resource-root>

              </resources>

          </deployment>

      </jboss-deployment-structure>

       

      It doesn't work, the wiki (https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7) and xsd (https://github.com/jbossas/jboss-as/blob/master/build/src/main/resources/docs/schema/jboss-deployment-structure-1_2.xsd) doesn't talk much about ear/lib folder and I don't find the correct way to exclude birt's dom4j from classpath.