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

ModelInterpreter.groovy unable to resolve class javax.annotation.Nonnull with Jenkins v2.235.1

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • Jenkins v2.235.1 upgraded from v2.222.4

      significant plugins:
      Git 4.3.0
      Pipeline 2.6
      Pipeline: Multibranch 2.21
      Pipeline: Declarative 1.7.0
      Pipeline: Groovy 2.81

      Jenkins server (windows, v2.222.4) was upgraded to latest version v2.235.1

      use a multibranch pipeline to git repo over proxy

      works well with v2.222.4

      crashs with v2.235.1

      only update Jenkins version, no plugin where updated

      significant error:

      hudson.remoting.ProxyException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      jar:file:/C:/JenkinsServices/Testing/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy: 43: unable to resolve class javax.annotation.Nonnull
       @ line 43, column 1.
         import javax.annotation.Nonnull
         ^
      
      jar:file:/C:/JenkinsServices/Testing/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy: 42: unable to resolve class javax.annotation.CheckForNull
       @ line 42, column 1.
         import javax.annotation.CheckForNull
         ^
      
      jar:file:/C:/JenkinsServices/Testing/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy: 455: unable to resolve class javax.annotation.CheckForNull ,  unable to find class for annotation
       @ line 455, column 30.
             def withCredentialsBlock(@CheckForNull Environment environment, Closure body) {
                                      ^
      
      jar:file:/C:/JenkinsServices/Testing/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy: 493: unable to resolve class javax.annotation.Nonnull ,  unable to find class for annotation
       @ line 493, column 13.
                     @Nonnull Map<String, CredentialWrapper> credentials) {
                     ^
      

      plain.log:

      Branch indexing
       > git.exe rev-parse --is-inside-work-tree # timeout=10
      Setting origin to https://bitbucket.********.com/scm/repo.git
       > git.exe config remote.origin.url https://bitbucket.********.com/scm/repo.git # timeout=10
      Fetching origin...
      Fetching upstream changes from origin
       > git.exe --version # timeout=10
       > git.exe config --get remote.origin.url # timeout=10
      using GIT_ASKPASS to set credentials 
      Setting http proxy: proxy.******.com:8080
       > git.exe fetch --tags --force --progress -- origin +refs/heads/*:refs/remotes/origin/* # timeout=10
      Seen branch in repository origin/*****
      Seen branch in repository origin/*****
      Seen branch in repository origin/*****
      Seen branch in repository origin/*****
      Seen branch in repository origin/*****
      Seen branch in repository origin/*****
      Seen branch in repository origin/*****
      Seen branch in repository origin/master
      Seen 8 remote branches
      Obtained Jenkinsfile from 176574b083d6a80fc40b6d38342b0ea0c131e6ab
      Running in Durability level: MAX_SURVIVABILITY
      [Pipeline] Start of Pipeline
      [Pipeline] End of Pipeline
      hudson.remoting.ProxyException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      jar:file:/C:/JenkinsServices/Testing/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy: 43: unable to resolve class javax.annotation.Nonnull
       @ line 43, column 1.
         import javax.annotation.Nonnull
         ^
      
      jar:file:/C:/JenkinsServices/Testing/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy: 42: unable to resolve class javax.annotation.CheckForNull
       @ line 42, column 1.
         import javax.annotation.CheckForNull
         ^
      
      jar:file:/C:/JenkinsServices/Testing/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy: 455: unable to resolve class javax.annotation.CheckForNull ,  unable to find class for annotation
       @ line 455, column 30.
             def withCredentialsBlock(@CheckForNull Environment environment, Closure body) {
                                      ^
      
      jar:file:/C:/JenkinsServices/Testing/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy: 493: unable to resolve class javax.annotation.Nonnull ,  unable to find class for annotation
       @ line 493, column 13.
                     @Nonnull Map<String, CredentialWrapper> credentials) {
                     ^
      
      4 errors
      
      	at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
      	at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:958)
      	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:554)
      	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:254)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:250)
      	at groovy.lang.GroovyClassLoader.recompile(GroovyClassLoader.java:766)
      	at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:718)
      	at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:787)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:405)
      	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell$TimingLoader.loadClass(CpsGroovyShell.java:170)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:405)
      	at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:677)
      	at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:787)
      	at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:775)
      	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelStepLoader.getValue(ModelStepLoader.java:60)
      	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:113)
      	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:498)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
      	at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:157)
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:142)
      	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)
      	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)
      	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
      	at WorkflowScript.run(WorkflowScript:1)
      	at ___cps.transform___(Native Method)
      	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:86)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83)
      	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:498)
      	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      	at com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:46)
      	at com.cloudbees.groovy.cps.Next.step(Next.java:83)
      	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
      	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
      	at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
      	at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
      	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
      	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:400)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:312)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:276)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
      	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
      	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)
      Finished: FAILURE
      

      .. and my job config:
      proxy config:

      multi branch pipeline config:

      and the JenkinsFile of master branch:

      pipeline
      {
        agent { label 'master' }
        stages
        {
          stage('Clean')
          {
            steps
            {
              bat "_clean.cmd"
            }
          }
          stage('Build')
          {
            steps
            {
              bat "_build.cmd"
              archiveArtifacts artifacts: '**/output/*', fingerprint: true, onlyIfSuccessful: true
            }
          }
          stage('FinalClean')
          {
            steps
            {
              bat "_clean.cmd"
            }
          }
        }
      }
      

      Jenkinsfile

        1. image-2020-07-07-11-10-34-527.png
          image-2020-07-07-11-10-34-527.png
          129 kB
        2. Jenkinsfile
          0.4 kB
        3. multi branch pipeline config.png
          multi branch pipeline config.png
          78 kB
        4. proxy config.png
          proxy config.png
          72 kB
        5. screenshot-1.png
          screenshot-1.png
          138 kB

          [JENKINS-62988] ModelInterpreter.groovy unable to resolve class javax.annotation.Nonnull with Jenkins v2.235.1

          Marko Kozlina added a comment -

          I have experienced the same problem. My tests show that issue is related to 'Pipeline: Groovy' (worflow-cps) plugin version 2.81. With version 2.80 everything is working fine.

          Marko Kozlina added a comment - I have experienced the same problem. My tests show that issue is related to 'Pipeline: Groovy' (worflow-cps) plugin version 2.81. With version 2.80 everything is working fine.

          Thomas Patzig added a comment -

          mkozlina
          verified: you are right ... it works with plugin downgrade...

          have manual install plugin "Pipeline: Groovy v2.80" via /pluginManager/advanced -> Upload Plugin

          https://updates.jenkins.io/download/plugins/workflow-cps/2.80/workflow-cps.hpi

          Thomas Patzig added a comment - mkozlina verified: you are right ... it works with plugin downgrade... have manual install plugin "Pipeline: Groovy v2.80" via /pluginManager/advanced -> Upload Plugin https://updates.jenkins.io/download/plugins/workflow-cps/2.80/workflow-cps.hpi

          Daniel Beck added a comment -

          CC dnusbaum who is the only contributor to 2.81.

          Daniel Beck added a comment - CC dnusbaum who is the only contributor to 2.81.

          Devin Nusbaum added a comment -

          This looks similar to JENKINS-61007. My guess is that it is related to the removal of the JSR-305 annotations in plugin-pom 4.0 and JENKINS-55973. workflow-cps 2.81 picked up plugin-pom 4.x via jenkinsci/workflow-cps-plugin #355. ModelInterpreter.groovy is CPS-transformed code, so perhaps at runtime the only dependencies it has available are those of workflow-cps and parent plugins (I think that in JTH tests it has access to everything from pipeline-model-definition because of class loading differences). I would have to test things to understand exactly what might be happening, I think that JENKINS-61007 was actually nondeterministic so there could be something else at play.

          At this point, we should probably remove all 3rd-party annotations from ModelInterpreter.groovy and add a big warning to the file that you shouldn't add any annotations going forward, because there is no good way to verify that things will actually work at runtime.

          Devin Nusbaum added a comment - This looks similar to JENKINS-61007 . My guess is that it is related to the removal of the JSR-305 annotations in plugin-pom 4.0 and JENKINS-55973 . workflow-cps 2.81 picked up plugin-pom 4.x via jenkinsci/workflow-cps-plugin #355 . ModelInterpreter.groovy is CPS-transformed code, so perhaps at runtime the only dependencies it has available are those of workflow-cps and parent plugins (I think that in JTH tests it has access to everything from pipeline-model-definition because of class loading differences). I would have to test things to understand exactly what might be happening, I think that JENKINS-61007 was actually nondeterministic so there could be something else at play. At this point, we should probably remove all 3rd-party annotations from ModelInterpreter.groovy and add a big warning to the file that you shouldn't add any annotations going forward, because there is no good way to verify that things will actually work at runtime.

          Devin Nusbaum added a comment -

          Devin Nusbaum added a comment - Untested PR that should help: https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/397 .

          Toshiki Inami added a comment - - edited

          Same issue Jenkins version v2.222.4 with Pipeline: Groovy v2.81, and fixed after downgrading it to v2.80.

          Toshiki Inami added a comment - - edited Same issue Jenkins version v2.222.4 with Pipeline: Groovy v2.81, and fixed after downgrading it to v2.80.

          Leo Sh added a comment -

          Same here, after updating the plugin to "Pipeline: Groovy v2.81" on Jenkins 2.243, pipeline jobs that previously worked started to fail. Downgrading the plugin to "Pipeline: Groovy v2.80" made it work again.

          Leo Sh added a comment - Same here, after updating the plugin to "Pipeline: Groovy v2.81" on Jenkins 2.243, pipeline jobs that previously worked started to fail. Downgrading the plugin to "Pipeline: Groovy v2.80" made it work again.

          Mark Waite added a comment - - edited

          Do the declarative pipeline plugin versions 1.7.1 resolve the issue for you leosh64, peco8, mkozlina, and thomaspatzig? Those versions were released yesterday with changes that should help.

          Mark Waite added a comment - - edited Do the declarative pipeline plugin versions 1.7.1 resolve the issue for you leosh64 , peco8 , mkozlina , and thomaspatzig ? Those versions were released yesterday with changes that should help.

          Thomas Patzig added a comment -

          markewaite
          have upgrade plugins

          Pipeline: Declarative 1.7.1
          Pipeline: Groovy 2.81

          ...and it works now.

          Thomas Patzig added a comment - markewaite have upgrade plugins Pipeline: Declarative 1.7.1 Pipeline: Groovy 2.81 ...and it works now.

          Leo Sh added a comment -

          markewaite yes, with the following versions everything is fine now:
          Pipeline: Declarative 1.7.1
          Pipeline: Groovy 2.81
          Jenkins 2.245
           

          Leo Sh added a comment - markewaite yes, with the following versions everything is fine now: Pipeline: Declarative 1.7.1 Pipeline: Groovy 2.81 Jenkins 2.245  

            dnusbaum Devin Nusbaum
            thomaspatzig Thomas Patzig
            Votes:
            3 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: