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

SloccountPublisher fails on Java 11 without --add-modules java.xml.bind

    • JAXB Plugin

      Using a Jenkins running on Java 11 (Java 11 support is currently in preview (https://jenkins.io/blog/2018/12/14/java11-preview-availability/), SloccountPublisher throws the following exception while generating the report.

      janv. 16, 2019 2:26:14 PM hudson.model.AbstractBuild$AbstractBuildExecution reportError
      WARNING: Step ‘Publish SLOCCount analysis results’ aborted due to exception: 
      java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
              at hudson.plugins.sloccount.SloccountPublisher.perform(SloccountPublisher.java:82)
              at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
              at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
              at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
              at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
              at hudson.model.Build$BuildExecution.post2(Build.java:186)
              at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
              at hudson.model.Run.execute(Run.java:1835)
              at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
              at hudson.model.ResourceController.execute(ResourceController.java:97)
              at hudson.model.Executor.run(Executor.java:429)
      Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
              at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1374)
              at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1327)
              at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1080)
              at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
              ... 11 more
      

      Expected behavior

      Though there is ongoing work to see how/if to keep making JAXB usages in Jenkins on Java 11+, it would be nice if the plugin code could be analyzed to see if it could work without depending on JAXB API (which has been removed from the JDK starting from Java 9+).

      Technical consideration

      Looking at the code quickly, I think the main (only?) reason JAXB usage is to marshall/unmarshall the ClocReport.

      I think replacing the serialization with an XStream marshalling would probably achieve the same thing, while removing the JAXB dependency.

          [JENKINS-55620] SloccountPublisher fails on Java 11 without --add-modules java.xml.bind

          Baptiste Mathus created issue -
          Baptiste Mathus made changes -
          Labels Original: java11 java11-compatibility New: fosdem2019 java11 java11-compatibility
          Baptiste Mathus made changes -
          Link New: This issue relates to JENKINS-51965 [ JENKINS-51965 ]
          Baptiste Mathus made changes -
          Remote Link New: This issue links to "PR (Web Link)" [ 22213 ]
          Isa Vilacides made changes -
          Labels Original: fosdem2019 java11 java11-compatibility New: fosdem2019 java11 java11-compatibility triaged
          Baptiste Mathus made changes -
          Link New: This issue relates to JENKINS-55681 [ JENKINS-55681 ]
          Oleg Nenashev made changes -
          Released As New: JAXB Plugin
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Fixed but Unreleased [ 10203 ]
          Oleg Nenashev made changes -
          Status Original: Fixed but Unreleased [ 10203 ] New: Resolved [ 5 ]
          Basil Crow made changes -
          Link New: This issue duplicates JENKINS-68514 [ JENKINS-68514 ]

            npiguet npiguet
            batmat Baptiste Mathus
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: