Any workflow script doesn't work. Even this:

      node {
      }
      

      All variants provides this stacktrace in build log:

      Started by user Kanstantsin Shautsou
      java.lang.ExceptionInInitializerError
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
      	at java.lang.Class.newInstance(Class.java:442)
      	at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:408)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:743)
      	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:106)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:361)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:328)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:189)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:381)
      Caused by: groovy.lang.MissingMethodException: No signature of method: com.cloudbees.groovy.cps.Builder.withClosureType() is applicable for argument types: (java.lang.Class) values: [class org.jenkinsci.plugins.workflow.cps.CpsClosure2]
      	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
      	at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
      	at WorkflowScript.___cps___0(WorkflowScript)
      	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:497)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
      	at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite$StaticMetaMethodSiteNoUnwrapNoCoerce.invoke(StaticMetaMethodSite.java:148)
      	at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.callStatic(StaticMetaMethodSite.java:99)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:50)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:157)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:161)
      	at WorkflowScript.<clinit>(WorkflowScript)
      	... 13 more
      Finished: FAILURE
      

      How this supposed to be debugged by user?

          [JENKINS-30390] workflow ExceptionInInitializerError

          Kanstantsin Shautsou created issue -
          Kanstantsin Shautsou made changes -
          Description Original: Installed docker-workflow and workflow job trying hello world described at http://documentation.cloudbees.com/docs/cje-user-guide/docker-workflow-sect-inside.html
          {code}
          node('jenkins-slave-latest') {
            docker.withServer("http://${env.host_docker1}:4243") {
             docker.image("postgres:9.4.4").inside {
              sh "echo hello world"
             }
           }
          }
          {code}
          {code}
          Started by user Kanstantsin Shautsou
          java.lang.ExceptionInInitializerError
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
          at java.lang.Class.newInstance(Class.java:442)
          at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:408)
          at groovy.lang.GroovyShell.parse(GroovyShell.java:743)
          at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:106)
          at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:361)
          at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:328)
          at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:189)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:381)
          Caused by: groovy.lang.MissingMethodException: No signature of method: com.cloudbees.groovy.cps.Builder.withClosureType() is applicable for argument types: (java.lang.Class) values: [class org.jenkinsci.plugins.workflow.cps.CpsClosure2]
          at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
          at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
          at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
          at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
          at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
          at WorkflowScript.___cps___0(WorkflowScript)
          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:497)
          at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
          at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite$StaticMetaMethodSiteNoUnwrapNoCoerce.invoke(StaticMetaMethodSite.java:148)
          at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.callStatic(StaticMetaMethodSite.java:99)
          at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:50)
          at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:157)
          at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:161)
          at WorkflowScript.<clinit>(WorkflowScript)
          ... 13 more
          Finished: FAILURE
          {code}
          How this supposed to be debugged by user?
          New: Installed docker-workflow and workflow job trying hello world described at http://documentation.cloudbees.com/docs/cje-user-guide/docker-workflow-sect-inside.html and then this
          {code}
          node('jenkins-slave-latest') {
            docker.withServer("http://${env.host_docker1}:4243") {
             docker.image("postgres:9.4.4").inside {
              sh "echo hello world"
             }
           }
          }
          {code}
          All variants provides this stacktrace on the full screen
          {code}
          Started by user Kanstantsin Shautsou
          java.lang.ExceptionInInitializerError
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
          at java.lang.Class.newInstance(Class.java:442)
          at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:408)
          at groovy.lang.GroovyShell.parse(GroovyShell.java:743)
          at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:106)
          at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:361)
          at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:328)
          at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:189)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:381)
          Caused by: groovy.lang.MissingMethodException: No signature of method: com.cloudbees.groovy.cps.Builder.withClosureType() is applicable for argument types: (java.lang.Class) values: [class org.jenkinsci.plugins.workflow.cps.CpsClosure2]
          at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
          at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
          at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
          at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
          at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
          at WorkflowScript.___cps___0(WorkflowScript)
          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:497)
          at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
          at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite$StaticMetaMethodSiteNoUnwrapNoCoerce.invoke(StaticMetaMethodSite.java:148)
          at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.callStatic(StaticMetaMethodSite.java:99)
          at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:50)
          at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:157)
          at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:161)
          at WorkflowScript.<clinit>(WorkflowScript)
          ... 13 more
          Finished: FAILURE
          {code}
          How this supposed to be debugged by user?

          Jesse Glick added a comment -

          I ran 1.609.3, added Workflow: Aggregator and CloudBees Docker Workflow, created a flow with the script (as structurally close to yours as I could manage while still being usable in my environment)

          node('master') {
            docker.withServer("tcp://0.0.0.0${env.GLADE_CATALOG_PATH}2375") { 
             docker.image("postgres:9.4.4").inside {
              sh "echo hello world"
             }
           }
          }
          

          and it passed.

          Tried the same using with Use Groovy Sandbox checked. Then I got an error, though very different from yours:

          org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method groovy.lang.GroovyObject getProperty java.lang.String (org.jenkinsci.plugins.workflow.cps.CpsClosure2.docker)
          	at org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectMethod(StaticWhitelist.java:155)
          	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.rejectField(SandboxInterceptor.java:186)
          	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:172)
          	at org.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:153)
          	at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:150)
          	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:23)
          	at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:17)
          	at WorkflowScript.run(WorkflowScript:2)
          	at Unknown.Unknown(Unknown)
          	at ___cps.transform___(Native Method)
          	at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:62)
          	at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
          	at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:54)
          	at sun.reflect.GeneratedMethodAccessor254.invoke(Unknown Source)
          	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          	at java.lang.reflect.Method.invoke(Method.java:497)
          	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
          	at com.cloudbees.groovy.cps.Next.step(Next.java:58)
          	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:145)
          	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:19)
          	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
          	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
          	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:106)
          	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
          	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)
          	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:271)
          	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:71)
          	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:180)
          	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:178)
          	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
          	at …
          

          which seems related to JENKINS-30222.

          In no case was I able to reproduce the exception you saw, which is meaningless to me. Possibly a bug in groovy-cps but have no way of diagnosing it without being able to reproduce from scratch.

          Jesse Glick added a comment - I ran 1.609.3, added Workflow: Aggregator and CloudBees Docker Workflow, created a flow with the script (as structurally close to yours as I could manage while still being usable in my environment) node( 'master' ) { docker.withServer( "tcp: //0.0.0.0${env.GLADE_CATALOG_PATH}2375" ) { docker.image( "postgres:9.4.4" ).inside { sh "echo hello world" } } } and it passed. Tried the same using with Use Groovy Sandbox checked. Then I got an error, though very different from yours: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method groovy.lang.GroovyObject getProperty java.lang. String (org.jenkinsci.plugins.workflow.cps.CpsClosure2.docker) at org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectMethod(StaticWhitelist.java:155) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.rejectField(SandboxInterceptor.java:186) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:172) at org.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:153) at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:150) at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:23) at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:17) at WorkflowScript.run(WorkflowScript:2) at Unknown.Unknown(Unknown) at ___cps.transform___(Native Method) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:62) at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:54) at sun.reflect.GeneratedMethodAccessor254.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21) at com.cloudbees.groovy.cps.Next.step(Next.java:58) at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:145) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:19) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:106) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:271) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:71) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:180) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:178) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47) at … which seems related to JENKINS-30222 . In no case was I able to reproduce the exception you saw, which is meaningless to me. Possibly a bug in groovy-cps but have no way of diagnosing it without being able to reproduce from scratch.
          Jesse Glick made changes -
          Component/s Original: docker-workflow-plugin [ 20625 ]
          Summary Original: non debuggable errors New: Groovy errors when nesting docker.* blocks
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-30222 [ JENKINS-30222 ]
          Jesse Glick made changes -
          Link New: This issue is blocking JENKINS-26135 [ JENKINS-26135 ]

          Jesse Glick added a comment -

          I suspect that changes made to Closure handling in JENKINS-26135 are still not right.

          Jesse Glick added a comment - I suspect that changes made to Closure handling in JENKINS-26135 are still not right.

          Jesse Glick added a comment -

          Tried make -C docker-workflow-plugin/demo run-cached, update Workflow: Aggregator, restart, Build Now; but that worked (and it is using CPS from SCM, which is automatically sandboxed).

          BTW Support Core plugin is a better way of capturing your environment for diagnosis.

          Jesse Glick added a comment - Tried make -C docker-workflow-plugin/demo run-cached , update Workflow: Aggregator , restart, Build Now ; but that worked (and it is using CPS from SCM, which is automatically sandboxed). BTW Support Core plugin is a better way of capturing your environment for diagnosis.

          Jesse Glick added a comment -

          Also after updating docker-workflow to build against 1.609.3 and Workflow 1.10 (and script-security 1.15), all functional tests pass, including those which nest blocks much like your script, and run in the sandbox. So not clear to me yet what conditions trigger this.

          Jesse Glick added a comment - Also after updating docker-workflow to build against 1.609.3 and Workflow 1.10 (and script-security 1.15), all functional tests pass, including those which nest blocks much like your script, and run in the sandbox. So not clear to me yet what conditions trigger this.

          I'm using script entered in UI without any sandboxes of course.

          Kanstantsin Shautsou added a comment - I'm using script entered in UI without any sandboxes of course.

            drulli Ulli Hafner
            integer Kanstantsin Shautsou
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: