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

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

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      JAXB Plugin

      Description

      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.

        Attachments

          Issue Links

            Activity

            Hide
            batmat Baptiste Mathus added a comment -

            the PR is proposing a fix, which implies releasing the new JAXB plugin (JENKINS-55681).

            I created a dedicated Docker image for anyone to test this easily https://github.com/batmat/jaxb-java11-demo

            Show
            batmat Baptiste Mathus added a comment - the PR is proposing a fix, which implies releasing the new JAXB plugin ( JENKINS-55681 ). I created a dedicated Docker image for anyone to test this easily https://github.com/batmat/jaxb-java11-demo
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            Fixed by the JAXB Plugin

            Show
            oleg_nenashev Oleg Nenashev added a comment - Fixed by the JAXB Plugin
            Hide
            daddyman Brian Walker added a comment -

            I could not get this to work on e JAVA 11 worker node (main Jenkins node is running Java 8).  I ended up forking the GitHub repo and using xstream instead of JAXB. That version works on Jenkins worker nodes running either Java 8 or Java 11.

            Show
            daddyman Brian Walker added a comment - I could not get this to work on e JAVA 11 worker node (main Jenkins node is running Java 8).  I ended up forking the GitHub repo and using xstream instead of JAXB. That version works on Jenkins worker nodes running either Java 8 or Java 11.
            Hide
            batmat Baptiste Mathus added a comment -

            Brian Walker what error did you get?

            Also, IIUC you mean you're running the controller (fka "master") with a major Java version that's different from the agent (that you call "worker node" in your comment?). If so, please beware that's a strongly discouraged setup : it will seem to work, but will fail badly in subtle manners (sometimes hard to diagnose). For your mental health it's warmly recommended to use the same major version on all nodes .

            Show
            batmat Baptiste Mathus added a comment - Brian Walker what error did you get? Also, IIUC you mean you're running the controller (fka "master") with a major Java version that's different from the agent (that you call "worker node" in your comment?). If so, please beware that's a strongly discouraged setup : it will seem to work, but will fail badly in subtle manners (sometimes hard to diagnose). For your mental health it's warmly recommended to use the same major version on all nodes .

              People

              Assignee:
              npiguet npiguet
              Reporter:
              batmat Baptiste Mathus
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: