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

Invoking groovy script via CLI fails with spurious 'missing jar' error.

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: Minor Minor
    • cli, core, email-ext-plugin
    • None
    • This is occurring on various machines running 1.596.3 LTS and 1.596.2 LTS on Centos 6.6. They have various plugins installed, however the likely relevant plugins, (mailer, email-ext) are the latest and greatest on each machine.

      We manage our Jenkins infrastructure via Chef which is configured to automatically upgrade the machines to the latest LTS version when it comes out. Chef runs on each machine every 30 min. Immediately following the latest LTS release to 1.596.3, our chef runs started failing frequently but intermittently (about 50% of the time). The run fails at the point where we use the jenkins-cli groovy to configure certain properties of the mailer by means of running a script.

      The script template looks like the following:

      import jenkins.model.*
      
      def inst = Jenkins.getInstance()
      
      def desc = inst.getDescriptor('hudson.tasks.Mailer')
      
      desc.setSmtpHost("#{node['cvent-jenkins']['email-ext-plugin']['host']}")
      desc.setDefaultSuffix("#{node['cvent-jenkins']['email-ext-plugin']['defaultSuffix']}")
      desc.setReplyToAddress("#{node['cvent-jenkins']['email-ext-plugin']['replyTo']}")
          
      desc.save()
      

      The exception we are seeing is as follows: Note that the referenced jar (/var/lib/jenkins/plugins/email-ext/WEB-INF/lib/groovy-all-1.8.5.jar) is present in the location specified in the error report.

      ---- Begin output of "java" -jar "/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 -i "/var/chef/cache/jenkins-key" groovy /tmp/groovy20150521-23664-y63ckb ----
      STDOUT: 
      STDERR: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      IO Exception attempting to load global transforms:/var/lib/jenkins/plugins/email-ext/WEB-INF/lib/groovy-all-1.8.5.jar (No such file or directory)
      
      1 error
      
        at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:302)
        at org.codehaus.groovy.control.ProcessingUnit.completePhase(ProcessingUnit.java:143)
        at org.codehaus.groovy.control.ProcessingUnit.gotoPhase(ProcessingUnit.java:162)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:493)
        at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:302)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:281)
        at groovy.lang.GroovyShell.parseClass(GroovyShell.java:731)
        at groovy.lang.GroovyShell.run(GroovyShell.java:516)
        at hudson.cli.GroovyCommand.run(GroovyCommand.java:94)
        at hudson.cli.CLICommand.main(CLICommand.java:237)
        at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:326)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:301)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:260)
        at hudson.remoting.UserRequest.perform(UserRequest.java:121)
        at hudson.remoting.UserRequest.perform(UserRequest.java:49)
        at hudson.remoting.Request$2.run(Request.java:324)
        at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
        at hudson.cli.CliManagerImpl$1.call(CliManagerImpl.java:63)
        at hudson.remoting.CallableDecoratorAdapter.call(CallableDecoratorAdapter.java:18)
        at hudson.remoting.CallableDecoratorList$1.call(CallableDecoratorList.java:21)
        at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
      ---- End output of "java" -jar "/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 -i "/var/chef/cache/jenkins-key" groovy /tmp/groovy20150521-23664-y63ckb ----
      Ran "java" -jar "/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 -i "/var/chef/cache/jenkins-key" groovy /tmp/groovy20150521-23664-y63ckb returned 255
      

      We have attempted to reproduce the problem by running the same script in the groovy console but have not encountered the error under those conditions.

          [JENKINS-28527] Invoking groovy script via CLI fails with spurious 'missing jar' error.

          Alex Earl added a comment -

          What was the previous version of Jenkins that you had?

          Alex Earl added a comment - What was the previous version of Jenkins that you had?

          Previous version was 1.596.2 LTS

          Kenneth Baltrinic added a comment - Previous version was 1.596.2 LTS

          Alex Earl added a comment -

          Were the plugins updated at the same time?

          Alex Earl added a comment - Were the plugins updated at the same time?

          Kenneth Baltrinic added a comment - - edited

          No plugins get upgraded separately. One of the machine is on the latest and greatest of all the plugins. Others are a about 4 - 5 months out of date with regard to plug-ins.

          NOTE: We have downgraded all of our boxes to 1.596.2 and the problem is still there, so my original assumption that this is a 1.596.3 bug appears to be incorrect, even though the onset of the issue does correlate with the 1.596.3 timeframe.

          I concur that this is likely not an issue with the mailer but with the groove/java core. If I removed the mailer configuration recipe from our chef cookbook, my guess is the next recipe that invokes groovy via the CLI would start to fail with the same error. The mailer recipe just happens to be the first and therefore the one to fail.

          Kenneth Baltrinic added a comment - - edited No plugins get upgraded separately. One of the machine is on the latest and greatest of all the plugins. Others are a about 4 - 5 months out of date with regard to plug-ins. NOTE: We have downgraded all of our boxes to 1.596.2 and the problem is still there, so my original assumption that this is a 1.596.3 bug appears to be incorrect, even though the onset of the issue does correlate with the 1.596.3 timeframe. I concur that this is likely not an issue with the mailer but with the groove/java core. If I removed the mailer configuration recipe from our chef cookbook, my guess is the next recipe that invokes groovy via the CLI would start to fail with the same error. The mailer recipe just happens to be the first and therefore the one to fail.

          Attaching Core Support package from shortly after an occurrence of this error.

          Kenneth Baltrinic added a comment - Attaching Core Support package from shortly after an occurrence of this error.

          Daniel Beck added a comment -

          kbaltrinic Is Jesse aware you assigned him?

          Daniel Beck added a comment - kbaltrinic Is Jesse aware you assigned him?

          Jesse Glick added a comment -

          Uh, no.

          Jesse Glick added a comment - Uh, no.

          Alex Earl added a comment - - edited

          What does this do?

          #{node['cvent-jenkins']['email-ext-plugin']['host']}
          

          Does it just pull information from a data store, or does it do something with email-ext via groovy?

          Alex Earl added a comment - - edited What does this do? #{node[ 'cvent-jenkins' ][ 'email-ext-plugin' ][ 'host' ]} Does it just pull information from a data store, or does it do something with email-ext via groovy?

          Alex Earl added a comment -

          If you are willing, can you try the attached email-ext plugin version? I removed the direct dependency on groovy and use the one included with Jenkins. I haven't been able to test this very much.

          Alex Earl added a comment - If you are willing, can you try the attached email-ext plugin version? I removed the direct dependency on groovy and use the one included with Jenkins. I haven't been able to test this very much.

          Alex Earl added a comment -

          Need more info to debug this issue.

          Alex Earl added a comment - Need more info to debug this issue.

            Unassigned Unassigned
            kbaltrinic Kenneth Baltrinic
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: