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

Tools installation for SonarQube Scanner fails with nullPointerException

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • None
    • Windows 2016
      jenkins 2.204.2
    • workflow-basic-steps-1049.v257a_e6b_30fb_d

      Summary

      Automatic tool installation for SonarQube Scanner fails with

      java.lang.NullPointerException at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:150) at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:133)
      

      Details

      I have the following tool configuration for SonarQube Scanner under "Global Tool Configuration"

      I call the automatic tool installation as follows:

      def scannerName = "SonarQube Scanner"
         def sqScannerHome
      try {
         sqScannerHome = tool scannerName
      } catch(Exception ex) {
         echo "[ERROR] Problem installing '${scannerName}'\n${ex}"
         throw ex
      }
      

      This call ends in the following error

      java.lang.NullPointerException
      	at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:150)
      	at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:133)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      

      This worked so I suspected one of the plugin updates broke it so I've tried the current versions, and the previous versions of these plugins:

      Pipeline: API 2.40 2.39
      Pipeline: Basic Steps 2.19 2.18
      SonarQube Scanner 2.11 2.10

       

          [JENKINS-61474] Tools installation for SonarQube Scanner fails with nullPointerException

          papanito added a comment -

          Other tool installations are not affected so e.g. JDK installation works fine
          Unpacking https://generic.intra/local-generic-devops/AdoptOpenJDK/OpenJDK11U-jdk_x86-32_windows_hotspot_11.0.5_10.zip to D:\jenkins\tools\ci-home\tools\hudson.model.JDK\JAVA-DEFAULT on xx-xxxx

          papanito added a comment - Other tool installations are not affected so e.g. JDK installation works fine Unpacking https://generic.intra/local-generic-devops/AdoptOpenJDK/OpenJDK11U-jdk_x86-32_windows_hotspot_11.0.5_10.zip to D:\jenkins\tools\ci-home\tools\hudson.model.JDK\JAVA-DEFAULT on xx-xxxx

          papanito added a comment -

          The same error also occurs when using a fixed installation path

          aThis path exists on the slave

          papanito added a comment - The same error also occurs when using a fixed installation path aThis path exists on the slave

          We also have this issue since updating plugins last week. Defining the scanner tool this way fixes the issue for us:

          def sonarScanner = tool name: 'SonarQube', type: 'hudson.plugins.sonar.SonarRunnerInstallation'
          

          Thorsten Gilfert added a comment - We also have this issue since updating plugins last week. Defining the scanner tool this way fixes the issue for us: def sonarScanner = tool name: 'SonarQube' , type: 'hudson.plugins.sonar.SonarRunnerInstallation'

          Denys Digtiar added a comment -

          In my experience, this can be caused by missing "Name" in certain tool installations which interpret empty name as `null` (e.g. Allure plugin). The `type` workaround works because it narrows down the search to one specific tool, hence avoiding problematic installation.

          I submitted https://github.com/jenkinsci/workflow-basic-steps-plugin/pull/302

          Denys Digtiar added a comment - In my experience, this can be caused by missing "Name" in certain tool installations which interpret empty name as `null` (e.g. Allure plugin). The `type` workaround works because it narrows down the search to one specific tool, hence avoiding problematic installation. I submitted https://github.com/jenkinsci/workflow-basic-steps-plugin/pull/302

          Denys Digtiar added a comment -

          My PR was merged and released - https://github.com/jenkinsci/workflow-basic-steps-plugin/releases/tag/1049.v257a_e6b_30fb_d

          I will mark this as Solved since this Exception should no longer happen. The root cause however is that it is possible to create Tool installations with empty names.

          Denys Digtiar added a comment - My PR was merged and released - https://github.com/jenkinsci/workflow-basic-steps-plugin/releases/tag/1049.v257a_e6b_30fb_d I will mark this as Solved since this Exception should no longer happen. The root cause however is that it is possible to create Tool installations with empty names.

            duemir Denys Digtiar
            papanito papanito
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: