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

Cppcheck is not compatible with Java 11

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • cppcheck-plugin
    • 1.26

    Description

      Failure happens with whatever JDK/JRE11. Works however with JRE8.

      Seems to be similar to
      https://issues.jenkins-ci.org/browse/JENKINS-55202?jql=project%20%3D%20JENKINS%20AND%20component%20%3D%20performance-signature-dynatrace-plugin

      Workaround described here did not help:
      https://wiki.jenkins.io/display/JENKINS/JAXB+usage+in+Jenkins+plugins

      323/323 files checked 100% done
      [Cppcheck] Starting the cppcheck analysis.
      [Cppcheck] Processing 1 files with the pattern '**/cppcheck-result.xml'.
      [Cppcheck] Parsing throws exceptions. javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
       - with linked exception:
      [java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
      [Cppcheck] java.io.IOException: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
       - with linked exception:
      [java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
      	at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)
      	at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)
      	at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)
      	at hudson.FilePath.act(FilePath.java:1076)
      	at hudson.FilePath.act(FilePath.java:1059)
      	at org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:406)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
      	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:1919)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:428)
      Caused by: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
       - with linked exception:
      [java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
      	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:278)
      	at javax.xml.bind.ContextFinder.find(ContextFinder.java:421)
      	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721)
      	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662)
      	at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:53)
      	... 14 more
      Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory
      	at jenkins.telemetry.impl.java11.CatcherClassLoader.findClass(CatcherClassLoader.java:47)
      	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
      	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
      	at javax.xml.bind.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:122)
      	at javax.xml.bind.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:155)
      	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:276)
      	... 18 moreBuild step 'Publish Cppcheck results' changed build result to FAILURE
      Build step 'Publish Cppcheck results' marked build as failure
      [Checks API] No suitable checks publisher found.
      Finished: FAILURE 

      Attachments

        Issue Links

          Activity

            Alternatively, the Warnings Next Generation plugin is more actively maintained and can parse CPPCheck reports.

            Actually you are right!
            Warnings Next Generation is indeed better alternative to cppcheck plugin.
            I am going to migrate our Jenkins-CI-farm to WNG in the near future.

            reanimator Aleksandrs Gumenuks added a comment - Alternatively, the Warnings Next Generation plugin is more actively maintained and can parse CPPCheck reports. Actually you are right! Warnings Next Generation is indeed better alternative to cppcheck plugin. I am going to migrate our Jenkins-CI-farm to WNG in the near future.
            michaelbminer Michael Miner added a comment - - edited

            Serious question from a new jenkins user. I am trying to use WNG in my build now. However I am not sure what to put into the cppcheck pattern.

            michaelbminer Michael Miner added a comment - - edited Serious question from a new jenkins user. I am trying to use WNG in my build now. However I am not sure what to put into the cppcheck pattern.

            Serious question from a new jenkins user. I am trying to use WNG in my build now. However I am not sure what to put into the cppcheck pattern.

            If I grasp you concern correctly, than I may share the configuration I tested with you:

            command line of shell task where cppcheck is called
            /opt/tools/cppcheck-2.5/bin/cppcheck -j ${CPU_COUNT} --inline-suppr --enable=all --inconclusive --xml --xml-version=2 -i ${WORKSPACE}/src/components/external ${WORKSPACE}/src 2> cppcheck-result.xml
            
            Report File Patter of WNG
            **/cppcheck-result.xml 
            

            reanimator Aleksandrs Gumenuks added a comment - Serious question from a new jenkins user. I am trying to use WNG in my build now. However I am not sure what to put into the cppcheck pattern. If I grasp you concern correctly, than I may share the configuration I tested with you: command line of shell task where cppcheck is called /opt/tools/cppcheck-2.5/bin/cppcheck -j ${CPU_COUNT} --inline-suppr --enable=all --inconclusive --xml --xml-version=2 -i ${WORKSPACE}/src/components/external ${WORKSPACE}/src 2> cppcheck-result.xml Report File Patter of WNG **/cppcheck-result.xml
            michaelbminer Michael Miner added a comment -

            I have two branches, one that uses CppCheck the way you described. 

             

            Using the warning next generations plugin from a jenkinsfile, to use CppCheck they say to do
            recordIssues tools: [gcc(),  codeAnalysis(), cppCheck(pattern: 'cppcheck.xml')]
            However I cannot find out what to put into this cppcheck.xml to make it all work. 

            michaelbminer Michael Miner added a comment - I have two branches, one that uses CppCheck the way you described.    Using the warning next generations plugin from a jenkinsfile, to use CppCheck they say to do recordIssues tools:  [gcc(),  codeAnalysis(), cppCheck(pattern: 'cppcheck.xml')] However I cannot find out what to put into this cppcheck.xml to make it all work. 
            basil Basil Crow added a comment -

            Fixed in jenkinsci/cppcheck-plugin#64. Released in 1.26.

            basil Basil Crow added a comment - Fixed in jenkinsci/cppcheck-plugin#64 . Released in 1.26 .

            People

              basil Basil Crow
              reanimator Aleksandrs Gumenuks
              Votes:
              8 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: