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

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

XMLWordPrintable

    • 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.

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

              Created:
              Updated:
              Resolved: