• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • cppcheck-plugin
    • 1.26

      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 

          [JENKINS-63808] Cppcheck is not compatible with Java 11

          The code in the pull request has been automatically built at ci.jenkins.io. From https://github.com/jenkinsci/cppcheck-plugin/pull/56, you can switch to the Checks tab, click "View more details on ci.jenkins.io", click "Artifacts" at the top of the page, download "target/cppcheck.hpi", and install that to your Jenkins controller.

          Kalle Niemitalo added a comment - The code in the pull request has been automatically built at ci.jenkins.io. From https://github.com/jenkinsci/cppcheck-plugin/pull/56 , you can switch to the Checks tab, click "View more details on ci.jenkins.io", click "Artifacts" at the top of the page, download "target/cppcheck.hpi", and install that to your Jenkins controller .

          Michael Miner added a comment -

          FYI the suggestion above from Kalle Niemitalo works! I have cppcheck running!

          Michael Miner added a comment - FYI the suggestion above from Kalle Niemitalo works! I have cppcheck running!

          Alternatively, the Warnings Next Generation plugin is more actively maintained and can parse CPPCheck reports. However, switching to it would require modifying your pipelines, and I'm not sure it has the same kind of REST API as the cppcheck plugin has.

          Kalle Niemitalo added a comment - Alternatively, the Warnings Next Generation plugin is more actively maintained and can parse CPPCheck reports . However, switching to it would require modifying your pipelines, and I'm not sure it has the same kind of REST API as the cppcheck plugin has.

          Aleksandrs Gumenuks added a comment - - edited

          The code in the pull request has been automatically built at ci.jenkins.io.

          I may confirm, that cppcheck run correctly with Java 11 for me now.
          Thank you very much indeed!

          cppcheck plug-in: 1.26-SNAPSHOT (private-821e9023-administrator)
          Jenkins-CI: 2.303.3
          JVM: AdoptOpenJDK-11.0.11+9

          Aleksandrs Gumenuks added a comment - - edited The code in the pull request has been automatically built at ci.jenkins.io. I may confirm, that cppcheck run correctly with Java 11 for me now. Thank you very much indeed! cppcheck plug-in : 1.26-SNAPSHOT (private-821e9023-administrator) Jenkins-CI : 2.303.3 JVM : AdoptOpenJDK-11.0.11+9

          Aleksandrs Gumenuks added a comment - - edited

          Aleksandrs Gumenuks added a comment - - edited Alternatively, the Warnings Next Generation plugin is more actively maintained and can parse CPPCheck reports. Thank for the hint! I'll certainly check it out soon.

          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.

          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.

          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.

          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 
          

          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

          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. 

          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 Crow added a comment -

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

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

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

              Created:
              Updated:
              Resolved: