Uploaded image for project: 'EJBCA'
  1. EJBCA
  2. ECA-7418

Java 11: Xerces throws ClassNotFoundException: org.w3c.dom.ls.DocumentLS

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: EJBCA 7.2.0
    • Component/s: None
    • Labels:
      None

      Description

      We use the XML parser from http://xerces.apache.org/ implicitly.

      The current version that we bundle as lib/batik/xerces.jar is 2.5.0 released in 2005.

      When trying to run the EJBCA EJB CLI this fails when invoked via Log4J:

      log4j:WARN Error during default initialization
      java.lang.NoClassDefFoundError: org/w3c/dom/ls/DocumentLS
      	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
      	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
      	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
      	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
      	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
      	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
      	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
      	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
      	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
      	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
      	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
      	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
      	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
      	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
      	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
      	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
      	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
      	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
      	at org.apache.xerces.util.ObjectFactory.findProviderClass(Unknown Source)
      	at org.apache.xerces.parsers.AbstractDOMParser.setDocumentClassName(Unknown Source)
      	at org.apache.xerces.parsers.AbstractDOMParser.reset(Unknown Source)
      	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      	at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
      	at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
      	at org.apache.log4j.xml.DOMConfigurator$2.parse(DOMConfigurator.java:769)
      	at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:871)
      	at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:778)
      	at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)
      	at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
      	at org.apache.log4j.Logger.getLogger(Logger.java:117)
      	at org.ejbca.ui.cli.infrastructure.library.CommandLibrary.<init>(CommandLibrary.java:44)
      	at org.ejbca.ui.cli.infrastructure.library.CommandLibrary.<clinit>(CommandLibrary.java:39)
      	at org.ejbca.ui.cli.EjbcaEjbCli.main(EjbcaEjbCli.java:29)
      Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ls.DocumentLS
      	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
      	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
      	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
      	... 33 more
      

      A similar failure also happens when trying to run tests via Apache ant:

      runone-internal:
          [mkdir] Created dir: /opt/ejbca/modules/systemtests/build/test/conf
           [copy] Warning: Could not find file /opt/ejbca/conf/extendedkeyusage.properties to copy.
           [echo] runone-internal.classpath=systemtests.classpath
          [junit] Running org.ejbca.core.protocol.ws.CertificateExtensionTest
          [junit] Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/dom/ls/DocumentLS
          [junit] 	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
          [junit] 	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
          [junit] 	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
          [junit] 	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
          [junit] 	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
          [junit] 	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
          [junit] 	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
          [junit] 	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
          [junit] 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
          [junit] 	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
          [junit] 	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
          [junit] 	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
          [junit] 	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
          [junit] 	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
          [junit] 	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
          [junit] 	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
          [junit] 	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
          [junit] 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
          [junit] 	at org.apache.xerces.jaxp.DocumentBuilderImpl.newDocument(Unknown Source)
          [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.startTestSuite(XMLJUnitResultFormatter.java:134)
          [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.fireStartTestSuite(JUnitTestRunner.java:847)
          [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:523)
          [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1196)
          [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:1041)
          [junit] Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ls.DocumentLS
          [junit] 	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
          [junit] 	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
          [junit] 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
          [junit] 	... 24 more
          [junit] Running org.ejbca.core.protocol.ws.CertificateExtensionTest
          [junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec
      

        Attachments

          Activity

            People

            Assignee:
            samuel Samuel Lidén Borell
            Reporter:
            johan Johan Eklund
            Verified by:
            Ulf Undmark
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 2 days
                2d
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours Time Not Required
                5h