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

Type java.lang$Enum not present when updating 2.6 to 2.7

    • Pipeline - April 2018

      When Updating to the to the latest version of the workflow-api-plugin 2.7 the executing of my pipeline breaks with the following error backtrace:

      Error Backtrace

      java.lang.TypeNotPresentException: Type java.lang$Enum not present
      at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:117)
      at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
      at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
      at sun.reflect.generics.repository.ClassRepository.getSuperclass(ClassRepository.java:90)
      at java.lang.Class.getGenericSuperclass(Class.java:777)
      at com.sun.beans.TypeResolver.prepare(TypeResolver.java:308)
      at com.sun.beans.TypeResolver.resolve(TypeResolver.java:185)
      at com.sun.beans.TypeResolver.resolve(TypeResolver.java:218)
      at com.sun.beans.TypeResolver.resolve(TypeResolver.java:169)
      at com.sun.beans.TypeResolver.resolveInClass(TypeResolver.java:81)
      at java.beans.FeatureDescriptor.getReturnType(FeatureDescriptor.java:370)
      at java.beans.PropertyDescriptor.findPropertyType(PropertyDescriptor.java:648)
      at java.beans.PropertyDescriptor.updateGenericsFor(PropertyDescriptor.java:623)
      at java.beans.Introspector.addPropertyDescriptor(Introspector.java:605)
      at java.beans.Introspector.addPropertyDescriptors(Introspector.java:614)
      at java.beans.Introspector.getTargetPropertyInfo(Introspector.java:467)
      at java.beans.Introspector.getBeanInfo(Introspector.java:428)
      at java.beans.Introspector.getBeanInfo(Introspector.java:173)
      at groovy.lang.MetaClassImpl$15.run(MetaClassImpl.java:3290)
      at java.security.AccessController.doPrivileged(Native Method)
      at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:3288)
      at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3265)
      at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:254)
      at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:285)
      at org.codehaus.groovy.runtime.callsite.ClassMetaClassGetPropertySite.<init>(ClassMetaClassGetPropertySite.java:38)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.createClassMetaClassGetPropertySite(AbstractCallSite.java:373)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.createGetPropertySite(AbstractCallSite.java:325)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.acceptGetProperty(AbstractCallSite.java:312)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:296)
      at packageInstaller.call(packageInstaller.groovy)
      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:1215)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:812)
      at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:100)
      at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)
      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:151)
      at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21)
      at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:115)
      at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:103)
      at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)
      at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)
      at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16)
      at WorkflowScript.run(WorkflowScript:102)
      at __cps.transform__(Native Method)
      at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
      at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
      at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
      at sun.reflect.GeneratedMethodAccessor210.invoke(Unknown Source)
      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.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:103)
      at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
      at sun.reflect.GeneratedMethodAccessor210.invoke(Unknown Source)
      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.ConstantBlock.eval(ConstantBlock.java:21)
      at com.cloudbees.groovy.cps.Next.step(Next.java:58)
      at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
      at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
      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:108)
      at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
      at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:163)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:324)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224)
      at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
      at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      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:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.ClassNotFoundException: java.lang$Enum
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:677)
      at groovy.lang.GroovyClassLoader$InnerLoader.loadClass(GroovyClassLoader.java:425)
      at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:787)
      at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:775)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:348)
      at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
      at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
      at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
      at sun.reflect.generics.repository.ClassRepository.getSuperclass(ClassRepository.java:90)
      at java.lang.Class.getGenericSuperclass(Class.java:777)
      at com.sun.beans.TypeResolver.prepare(TypeResolver.java:308)
      at com.sun.beans.TypeResolver.resolve(TypeResolver.java:185)
      at com.sun.beans.TypeResolver.resolve(TypeResolver.java:218)
      at com.sun.beans.TypeResolver.resolve(TypeResolver.java:169)
      at com.sun.beans.TypeResolver.resolveInClass(TypeResolver.java:81)
      at java.beans.FeatureDescriptor.getReturnType(FeatureDescriptor.java:370)
      at java.beans.PropertyDescriptor.findPropertyType(PropertyDescriptor.java:648)
      at java.beans.PropertyDescriptor.updateGenericsFor(PropertyDescriptor.java:623)
      at java.beans.Introspector.addPropertyDescriptor(Introspector.java:605)
      at java.beans.Introspector.addPropertyDescriptors(Introspector.java:614)
      at java.beans.Introspector.getTargetPropertyInfo(Introspector.java:467)
      at java.beans.Introspector.getBeanInfo(Introspector.java:428)
      at java.beans.Introspector.getBeanInfo(Introspector.java:173)
      at groovy.lang.MetaClassImpl$15.run(MetaClassImpl.java:3290)
      at java.security.AccessController.doPrivileged(Native Method)
      at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:3288)
      at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3265)
      at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:254)
      at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:285)
      at org.codehaus.groovy.runtime.callsite.ClassMetaClassGetPropertySite.<init>(ClassMetaClassGetPropertySite.java:38)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.createClassMetaClassGetPropertySite(AbstractCallSite.java:373)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.createGetPropertySite(AbstractCallSite.java:325)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.acceptGetProperty(AbstractCallSite.java:312)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:296)
      at packageInstaller.call(packageInstaller.groovy)
      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:1215)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:812)
      at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:100)
      at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)
      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:151)
      at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21)
      at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:115)
      at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:103)
      at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)
      at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)
      at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16)
      ... 35 more

      I have no real idea what to look for in my pipeline script. I am not using any Enum Type myself. This issue makes it impossible for me to update the pipeline api plugin.

      With version 2.6 of the workflow-api-plugin everything works just fine.

          [JENKINS-40117] Type java.lang$Enum not present when updating 2.6 to 2.7

          Brian Ray added a comment -

          Good to know. I'm now a little leery of updating Pipeline plugins on the production instance, but that gives some confidence. Thanks.

          Brian Ray added a comment - Good to know. I'm now a little leery of updating Pipeline plugins on the production instance, but that gives some confidence. Thanks.

          Jesse Glick added a comment -

          I am afraid I have no leads to go on here. Something is going haywire deep in the bowels of Groovy and I do not see any indication of what Pipeline code could be responsible, or what recent changes might possibly be related. Anyone who can figure out how to reproduce this from scratch, please reopen of course.

          Jesse Glick added a comment - I am afraid I have no leads to go on here. Something is going haywire deep in the bowels of Groovy and I do not see any indication of what Pipeline code could be responsible, or what recent changes might possibly be related. Anyone who can figure out how to reproduce this from scratch, please reopen of course.

          Ricard F added a comment -

          Error is happening with Jenkins ver. 2.46.3 and last published plugins... something is wrong

          Ricard F added a comment - Error is happening with  Jenkins ver. 2.46.3  and last published plugins... something is wrong

          HemangLavana added a comment -

          I am also seeing this issue after upgrade of jenkins core to 2.46.3 (from 2.46.2) and upgrading other plugins.

          HemangLavana added a comment - I am also seeing this issue after upgrade of jenkins core to 2.46.3 (from 2.46.2) and upgrading other plugins.

          Jon Sten added a comment -

          ricardf and hemanglavana did my workaround work for you, i.e. restarting the master?

          Jon Sten added a comment - ricardf and hemanglavana did my workaround work for you, i.e. restarting the master?

          Eli Givoni added a comment -

          I got it as well on version 2.46.3

          I think it is related to restart jenkins from the browser with the restart URL after upgrading a plugin, I restarted it twice from the URL and got the error, service stop and start fix it, verified it twice.

           

          Eli Givoni added a comment - I got it as well on version 2.46.3 I think it is related to restart jenkins from the browser with the restart URL after upgrading a plugin, I restarted it twice from the URL and got the error, service stop and start fix it, verified it twice.  

          Dee Kryvenko added a comment -

          Having the same issue. Confirm that /safeRestart put jenkins into this state. Together with the fact /safeRestart does not picking up the new JAVA_OPTS setting, I start thinking /safeRestart is not really a restart, and something weird happening there.

          Dee Kryvenko added a comment - Having the same issue. Confirm that /safeRestart put jenkins into this state. Together with the fact /safeRestart does not picking up the new JAVA_OPTS setting, I start thinking /safeRestart is not really a restart, and something weird happening there.

          Jesse Glick added a comment -

          /safeRestart (or /restart) uses the Lifecycle in Jenkins, which will behave in different ways depending on operating system and on the precise way you launched it—e.g., as a service wrapper. Typically it tries to reset the JVM but will not rerun a launcher script.

          Again, is there a known way to reproduce from scratch? Until there is, nothing is going to happen here.

          Jesse Glick added a comment - /safeRestart (or /restart ) uses the Lifecycle in Jenkins, which will behave in different ways depending on operating system and on the precise way you launched it—e.g., as a service wrapper. Typically it tries to reset the JVM but will not rerun a launcher script. Again, is there a known way to reproduce from scratch ? Until there is, nothing is going to happen here.

          Andrew Bayer added a comment -

          Based on GROOVY-8217, looks like this is fixed in Groovy 2.4.11. We moved to Groovy 2.4.11 with core 2.61. I managed to reproduce this on core 2.60.3 by running a job with the script brianeray provided a bunch of times in parallel, restarting the master, and trying to run them again. I repeated that same process with core 2.61 (i.e., the one that went from Groovy 2.4.8 to Groovy 2.4.11) and it all worked fine. So looks like this is resolved by using a core 2.61 or later!

          Andrew Bayer added a comment - Based on GROOVY-8217 , looks like this is fixed in Groovy 2.4.11. We moved to Groovy 2.4.11 with core 2.61. I managed to reproduce this on core 2.60.3 by running a job with the script brianeray provided a bunch of times in parallel, restarting the master, and trying to run them again. I repeated that same process with core 2.61 (i.e., the one that went from Groovy 2.4.8 to Groovy 2.4.11) and it all worked fine. So looks like this is resolved by using a core 2.61 or later!

          Brian Ray added a comment -

          In agreement with abayer. This one has not popped up for us in a long time.

          Brian Ray added a comment - In agreement with abayer . This one has not popped up for us in a long time.

            abayer Andrew Bayer
            nitram Martin Karing
            Votes:
            4 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated:
              Resolved: