8 Replies Latest reply on Oct 24, 2011 6:18 PM by avernet

    How to debug an incorrect module dependency in JBoss 7?

    avernet Newbie

      I have a web app, which uses Sun's MSV library. All the classes for MSV are included in jars in the web app WEB-INF/lib. When deploying this app on JBoss 7, I get the following exception:

       

      java.lang.NoClassDefFoundError: Could not initialize class com.sun.msv.datatype.xsd.AnyURIType

              at com.sun.msv.datatype.xsd.DatatypeFactory.getTypeByName(DatatypeFactory.java:195)

              at com.sun.msv.datatype.xsd.ngimpl.DataTypeLibraryImpl.getType(DataTypeLibraryImpl.java:32)

              at com.sun.msv.datatype.xsd.ngimpl.DataTypeLibraryImpl.createDatatypeBuilder(DataTypeLibraryImpl.java:36)

              at com.sun.msv.reader.trex.ng.DataState.startSelf(DataState.java:58)

              at com.sun.msv.reader.State.init(State.java:153)

              at com.sun.msv.reader.GrammarReader.pushState(GrammarReader.java:576)

              at com.sun.msv.reader.SimpleState.startElement(SimpleState.java:71)

              at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)

              at com.sun.msv.reader.trex.TREXBaseReader.startElement(TREXBaseReader.java:184)

              at com.sun.msv.reader.trex.ng.RELAXNGReader.startElement(RELAXNGReader.java:524)

              at com.sun.msv.reader.trex.ng.comp.RELAXNGCompReader.startElement(RELAXNGCompReader.java:197)

              at orbeon.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:497)

              at orbeon.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:180)

              at orbeon.apache.xerces.xinclude.XIncludeHandler.emptyElement(XIncludeHandler.java:1024)

              at orbeon.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:275)

              at orbeon.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1654)

              at orbeon.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)

              at orbeon.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:845)

              at orbeon.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:768)

              at orbeon.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)

              at orbeon.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1201)

              at com.sun.msv.reader.util.GrammarLoader._loadSchema(GrammarLoader.java:514)

              at com.sun.msv.reader.util.GrammarLoader.parse(GrammarLoader.java:325)

              at com.sun.msv.reader.util.GrammarLoader.loadSchema(GrammarLoader.java:189)

              at com.sun.msv.verifier.jarv.TheFactoryImpl.parse(TheFactoryImpl.java:42)

              at com.sun.msv.verifier.jarv.FactoryImpl.compileSchema(FactoryImpl.java:98)

       

      It complains that it cannot find the class com.sun.msv.datatype.xsd.AnyURIType, but that class is present in one of the jars. I am assuming some of those classes on the stack trace were "incorrectly" picked up from a module that comes from JBoss, thus loaded from another class loader, rather than from a jar in the web app's WEB-INF/lib. But which one can it be? (The orbeon.apache.xerces you see there is a re-rooted version of Apache Xerces, so we can be sure it has been loaded from the web app jars.) I have seen that I can exclude some modules in the jboss-deployment-structure.xml, as follows, but which on should I exclude? How to find out?

       

      <jboss-deployment-structure>

          <ear-subdeployments-isolated>true</ear-subdeployments-isolated>

          <deployment>

              <exclusions>

                  <module name="com.sun.xml.bind"/>

                  <module name="org.codehaus.woodstox"/>

                  <module name="org.codehaus.jackson.jackson-xc"/>

              </exclusions>

          </deployment>

      </jboss-deployment-structure>

       

      Alex