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

NPE when starting a Groovy script but the configured version is not configured on the slave

    XMLWordPrintable

Details

    Description

      See screenshots for the job/slave config

      Stack trace:

      Started by user xxx
      Building remotely on xxx.xxx.xxx.xxx
      FATAL: null
      java.lang.NullPointerException
      	at hudson.Launcher.printCommandLine(Launcher.java:592)
      	at hudson.Launcher.maskedPrintCommandLine(Launcher.java:614)
      	at hudson.Launcher$LocalLauncher.launch(Launcher.java:698)
      	at hudson.Launcher$ProcStarter.start(Launcher.java:338)
      	at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:932)
      	at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:899)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      	at hudson.remoting.Request$2.run(Request.java:270)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      	at java.util.concurrent.FutureTask.run(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at hudson.remoting.Engine$1$1.run(Engine.java:60)
      	at java.lang.Thread.run(Unknown Source)
      

      Attachments

        Activity

          vjuranek vjuranek added a comment -

          Hi,
          could you be please more specific, how the given groovy version is configured? Is it configured (in global Jenkins configuration) via setting GROOVY_HOME or via auto-install?
          Thanks
          Vojtech

          vjuranek vjuranek added a comment - Hi, could you be please more specific, how the given groovy version is configured? Is it configured (in global Jenkins configuration) via setting GROOVY_HOME or via auto-install? Thanks Vojtech

          The referenced groovy version (1.8.1) is configured via GROOVY_HOME

          jotbepunkt Jens Baitinger added a comment - The referenced groovy version (1.8.1) is configured via GROOVY_HOME
          vjuranek vjuranek added a comment -

          Then it's IMHO expected behaviour, plugin expects groovy installation on given path. If there's not any, it fails. What would you propose as correct behaviour in such cases?
          Thanks

          vjuranek vjuranek added a comment - Then it's IMHO expected behaviour, plugin expects groovy installation on given path. If there's not any, it fails. What would you propose as correct behaviour in such cases? Thanks

          A failure is indeed the the behaviour I would have expected, but a NPE should never be a failure handling strategy as the user does not know about what went wrong or what he can do to prevent the failure in the future. I had to look into the code to find a hint that the executed command might not have been configured.

          Instead there should be an error message saying "Tool location for 'Groovy 1.8.1' not found at '/opt/groovy...'" or tool location for 'Groovy 1.8.1 not found' or something like that. This would help to find the problem source.

          (Maybe this is not a problem of the Groovy plugin but a general problem configuring external tools on slaves.)

          jotbepunkt Jens Baitinger added a comment - A failure is indeed the the behaviour I would have expected, but a NPE should never be a failure handling strategy as the user does not know about what went wrong or what he can do to prevent the failure in the future. I had to look into the code to find a hint that the executed command might not have been configured. Instead there should be an error message saying "Tool location for 'Groovy 1.8.1' not found at '/opt/groovy...'" or tool location for 'Groovy 1.8.1 not found' or something like that. This would help to find the problem source. (Maybe this is not a problem of the Groovy plugin but a general problem configuring external tools on slaves.)
          vjuranek vjuranek added a comment -

          yup, absolutely agree, that NPE should be replaced by clearly stated reason of failure and will look on it. (I originally wasn't sure, if you mean that jenkins should do some search for given groovy installation or try to install it from web or something like this)

          vjuranek vjuranek added a comment - yup, absolutely agree, that NPE should be replaced by clearly stated reason of failure and will look on it. (I originally wasn't sure, if you mean that jenkins should do some search for given groovy installation or try to install it from web or something like this)

          Code changed in jenkins
          User: Vojtech Juranek
          Path:
          src/main/java/hudson/plugins/groovy/Groovy.java
          http://jenkins-ci.org/commit/groovy-plugin/6ab2c9a830133e3f262102345d9be1ab8fde9066
          Log:
          [Fixed JENKINS-11652] Avoid NPE, add fallback if groovy executable is misconfigured.

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Vojtech Juranek Path: src/main/java/hudson/plugins/groovy/Groovy.java http://jenkins-ci.org/commit/groovy-plugin/6ab2c9a830133e3f262102345d9be1ab8fde9066 Log: [Fixed JENKINS-11652] Avoid NPE, add fallback if groovy executable is misconfigured.
          vjuranek vjuranek added a comment -

          Will be in the next release.

          vjuranek vjuranek added a comment - Will be in the next release.
          dogfood dogfood added a comment -

          Integrated in plugins_groovy #55
          [Fixed JENKINS-11652] Avoid NPE, add fallback if groovy executable is misconfigured. (Revision 6ab2c9a830133e3f262102345d9be1ab8fde9066)

          Result = SUCCESS
          Vojtech Juranek :
          Files :

          • src/main/java/hudson/plugins/groovy/Groovy.java
          dogfood dogfood added a comment - Integrated in plugins_groovy #55 [Fixed JENKINS-11652] Avoid NPE, add fallback if groovy executable is misconfigured. (Revision 6ab2c9a830133e3f262102345d9be1ab8fde9066) Result = SUCCESS Vojtech Juranek : Files : src/main/java/hudson/plugins/groovy/Groovy.java

          People

            vjuranek vjuranek
            jotbepunkt Jens Baitinger
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: