Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-51404

processMavenSpyLogs can fail with "java.lang.IllegalAccessError: tried to access method"

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • pipeline-maven-plugin
    • None
    • Jenkins Core 2.107.x
      Maven-pipeline 3.5.6

      Issue:
      When running a maven process inside of a build an error popped up saying

      java.lang.IllegalAccessError: tried to access method org.apache.xerces.parsers.XML11Configuration.getFeature0(Ljava/lang/String;)Z from class org.apache.xerces.parsers.XIncludeAwareParserConfiguration 
      at org.apache.xerces.parsers.XIncludeAwareParserConfiguration.getFeature(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 javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121) 
      at org.jenkinsci.plugins.pipeline.maven.MavenSpyLogProcessor.processMavenSpyLogs(MavenSpyLogProcessor.java:97) 
      at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution$WithMavenStepExecutionCallBack.finished(WithMavenStepExecution.java:1050) 
      

      It seems to come from the code here:
      https://github.com/jenkinsci/pipeline-maven-plugin/blob/1729e64250c10213ca428141092540bdeeaba97a/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/MavenSpyLogProcessor.java#L97

      Steps to reproduce:
      I have not been able to narrow down why it is unable to load a library so it happened with one job but not with others.

      Workaround:
      Disable the spy event entirely with `JENKINS_MAVEN_AGENT_DISABLED = true `

          [JENKINS-51404] processMavenSpyLogs can fail with "java.lang.IllegalAccessError: tried to access method"

          Alex Taylor created issue -

          I suspect that there is a problem of a xerces jar with an incompatible / outdated version being pulled in Jenkins classpath.

          Can you please look at the following FAQ entry and verify which jar provides Xerces parsing library
          https://wiki.jenkins.io/display/JENKINS/Pipeline+Maven+Plugin#PipelineMavenPlugin-WhydoIseemessages%22javax.xml.parsers.FactoryConfigurationError:Providerforclassjavax.xml.parsers.DocumentBuilderFactorycannotbecreated%22

          Cyrille Le Clerc added a comment - I suspect that there is a problem of a xerces jar with an incompatible / outdated version being pulled in Jenkins classpath. Can you please look at the following FAQ entry and verify which jar provides Xerces parsing library https://wiki.jenkins.io/display/JENKINS/Pipeline+Maven+Plugin#PipelineMavenPlugin-WhydoIseemessages%22javax.xml.parsers.FactoryConfigurationError:Providerforclassjavax.xml.parsers.DocumentBuilderFactorycannotbecreated%22
          Cyrille Le Clerc made changes -
          Link New: This issue is related to JENKINS-47486 [ JENKINS-47486 ]
          Cyrille Le Clerc made changes -
          Assignee Original: Alvaro Lobato [ alobato ] New: Cyrille Le Clerc [ cleclerc ]
          CloudBees Inc. made changes -
          Remote Link New: This issue links to "CloudBees Internal CD-554 (Web Link)" [ 20691 ]

          Alex Taylor added a comment -

          cleclerc

          The response was:

          class org.apache.xerces.jaxp.DocumentBuilderFactoryImpl -> file:/var/lib/jenkins/plugins/analysis-core/WEB-INF/lib/xercesImpl-2.11.0.jar

          So it does not seem too outdated(only 1 version back from what I can see). Should that be updated first?

          Alex Taylor added a comment - cleclerc The response was: class org.apache.xerces.jaxp.DocumentBuilderFactoryImpl -> file:/ var /lib/jenkins/plugins/analysis-core/WEB-INF/lib/xercesImpl-2.11.0.jar So it does not seem too outdated(only 1 version back from what I can see). Should that be updated first?

          Cyrille Le Clerc added a comment - - edited

          xercesImpl-2.11.0 seem to be clashing with the XML parser shipped with the JVM. I don't catch why the analysis-core plugin is pulling an XML Parser, there have been one in the JVM for years.

          I'm investigating further.

          Cyrille Le Clerc added a comment - - edited xercesImpl-2.11.0 seem to be clashing with the XML parser shipped with the JVM. I don't catch why the analysis-core plugin is pulling an XML Parser, there have been one in the JVM for years. I'm investigating further.

          Alex Taylor added a comment -

          cleclerc Did you get the chance to look at this further?

          Alex Taylor added a comment - cleclerc Did you get the chance to look at this further?

          Cyrille Le Clerc added a comment - - edited

          drulli can you please help us understand why analysis-core is pulling xercesImpl-2.11 that seem to cause problems with JVM's built-in XML parser on Java 8?

          The only usage I found of xerces code in analysis-core is the SaxSetup.java class that has been deprecated in 2016.

          Could analysis-core remove its dependency on xercesImpl, rely on the JVM's built-in parser (Jenkins now requires Java 8 that provides all the needed XML parsing capabilities) and remove SaxSetup.java?

          https://github.com/jenkinsci/analysis-core-plugin/blob/analysis-core-1.95/src/main/java/hudson/plugins/analysis/util/SaxSetup.java

          The problem is:

          java.lang.IllegalAccessError: tried to access method org.apache.xerces.parsers.XML11Configuration.getFeature0(Ljava/lang/String;)Z from class org.apache.xerces.parsers.XIncludeAwareParserConfiguration 
          at org.apache.xerces.parsers.XIncludeAwareParserConfiguration.getFeature(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 javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121) 
          

          Cyrille Le Clerc added a comment - - edited drulli can you please help us understand why analysis-core is pulling xercesImpl-2.11 that seem to cause problems with JVM's built-in XML parser on Java 8? The only usage I found of xerces code in analysis-core is the SaxSetup.java class that has been deprecated in 2016. Could analysis-core remove its dependency on xercesImpl, rely on the JVM's built-in parser (Jenkins now requires Java 8 that provides all the needed XML parsing capabilities) and remove SaxSetup.java? https://github.com/jenkinsci/analysis-core-plugin/blob/analysis-core-1.95/src/main/java/hudson/plugins/analysis/util/SaxSetup.java The problem is: java.lang.IllegalAccessError: tried to access method org.apache.xerces.parsers.XML11Configuration.getFeature0(Ljava/lang/String;)Z from class org.apache.xerces.parsers.XIncludeAwareParserConfiguration at org.apache.xerces.parsers.XIncludeAwareParserConfiguration.getFeature(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 javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)

          Ulli Hafner added a comment -

          I think it was needed due to some problems when parsing FindBugs files. If I remember correctly, it is not used anymore in the analysis_model library. It will replace analysis core very soon.

          Ulli Hafner added a comment - I think it was needed due to some problems when parsing FindBugs files. If I remember correctly, it is not used anymore in the analysis_model library. It will replace analysis core very soon.

            Unassigned Unassigned
            ataylor Alex Taylor
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: