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

Illegal reflective access by org.codehaus.groovy.reflection.CachedClass to hundreds of methods and fields

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • core
    • JDK 9, Jenkins 2.60.3 as described in my lts-with-plugins docker instance

    Description

      While exploring Jenkins 2.60.3 on Oracle Java 9 build 181 (pre-release), it reports illegal access exceptions and warns that a future release of Java 9 will forbid illegal access.

      A partial stack trace shows:

      WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/var/jenkins_home/war/WEB-INF/lib/groovy-all-2.4.8.jar) to method java.lang.reflect.Proxy.checkNewProxyPermission(java.lang.Class,java.lang.Class)
              at org.codehaus.groovy.reflection.CachedClass.makeAccessible(CachedClass.java:84)
              at org.codehaus.groovy.reflection.CachedClass.access$000(CachedClass.java:42)
              at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:109)
              at java.base/java.security.AccessController.doPrivileged(Native Method)
              at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:105)
              at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:102)
              at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:49)
              at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:36)
              at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:274)
              at groovy.lang.MetaClassImpl.populateMethods(MetaClassImpl.java:367)
              at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:346)
              at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3286)
              at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:271)
              at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:313)
              at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:258)
              at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:883)
              at org.kohsuke.stapler.jelly.groovy.Namespace.createInvoker(Namespace.java:74)
              at org.kohsuke.stapler.jelly.groovy.JellyBuilder.namespace(JellyBuilder.java:125)
              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:1218)
              at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1027)
              at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:815)
              at groovy.lang.GroovyObjectSupport.invokeMethod(GroovyObjectSupport.java:46)
              at org.kohsuke.stapler.jelly.groovy.GroovyClosureScript.invokeMethod(GroovyClosureScript.java:87)
              at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:75)
              at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
              at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
              at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
              at jenkins.widgets.BuildQueueWidget.index.run(index.groovy:3)
              at org.kohsuke.stapler.jelly.groovy.GroovierJellyScript.run(GroovierJellyScript.java:74)
              at org.kohsuke.stapler.jelly.groovy.GroovierJellyScript.run(GroovierJellyScript.java:62)
      

      The stack trace seems to appear any time I try to run a pipeline job.

      Reflective access exceptions are reported for the following fields:

      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.io.File.$assertionsDisabled
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.io.File.filePath
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.io.File.fs
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.io.File.path
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.io.File.PATH_OFFSET
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.io.File.prefixLength
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.io.File.PREFIX_LENGTH_OFFSET
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.io.File.serialVersionUID
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.io.File.status
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.io.File.UNSAFE
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.allPermDomain
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.ANNOTATION
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.annotationData
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.annotationType
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.cachedConstructor
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.classRedefinedCount
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.classValueMap
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.componentType
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.EMPTY_CLASS_ARRAY
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.ENUM
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.enumConstantDirectory
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.enumConstants
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.genericInfo
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.module
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.name
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.newInstanceCallerCache
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.packageName
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.reflectionData
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.reflectionFactory
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.serialPersistentFields
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.serialVersionUID
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Class.SYNTHETIC
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.reflect.Proxy.constructorParams
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.reflect.Proxy.EMPTY_CLASS_ARRAY
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.reflect.Proxy.h
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.reflect.Proxy.proxyCache
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.reflect.Proxy.PROXY_PACKAGE_PREFIX
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.reflect.Proxy.serialVersionUID
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.String.coder
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.String.COMPACT_STRINGS
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.String.hash
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.String.LATIN1
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.String.serialPersistentFields
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.String.serialVersionUID
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.String.UTF16
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.String.value
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.System.bootLayer
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.System.cons
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.System.lineSeparator
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.System.props
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.blocker
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.blockerLock
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.contextClassLoader
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.daemon
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.defaultUncaughtExceptionHandler
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.eetop
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.EMPTY_STACK_TRACE
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.group
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.inheritableThreadLocals
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.inheritedAccessControlContext
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.name
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.nativeParkEventPointer
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.parkBlocker
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.priority
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.single_step
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.stackSize
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.stillborn
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.SUBCLASS_IMPLEMENTATION_PERMISSION
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.target
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.threadInitNumber
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.threadLocalRandomProbe
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.threadLocalRandomSecondarySeed
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.threadLocalRandomSeed
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.threadLocals
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.threadQ
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.threadSeqNumber
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.threadStatus
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.tid
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.lang.Thread.uncaughtExceptionHandler
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.AbstractCollection.MAX_ARRAY_SIZE
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.AbstractList.modCount
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.AbstractMap.keySet
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.AbstractMap.values
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.ArrayList.DEFAULT_CAPACITY
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.ArrayList.DEFAULTCAPACITY_EMPTY_ELEMENTDATA
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.ArrayList.elementData
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.ArrayList.EMPTY_ELEMENTDATA
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.ArrayList.MAX_ARRAY_SIZE
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.ArrayList.serialVersionUID
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.ArrayList.size
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.Collections$UnmodifiableMap.entrySet
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.Collections$UnmodifiableMap.keySet
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.Collections$UnmodifiableMap.m
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.Collections$UnmodifiableMap.serialVersionUID
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.Collections$UnmodifiableMap.values
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.HashMap.DEFAULT_INITIAL_CAPACITY
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.HashMap.DEFAULT_LOAD_FACTOR
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.HashMap.entrySet
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.HashMap.loadFactor
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.HashMap.MAXIMUM_CAPACITY
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.HashMap.MIN_TREEIFY_CAPACITY
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.HashMap.modCount
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.HashMap.serialVersionUID
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.HashMap.size
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.HashMap.table
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.HashMap.threshold
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.HashMap.TREEIFY_THRESHOLD
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.HashMap.UNTREEIFY_THRESHOLD
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.HashSet.map
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.HashSet.PRESENT
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.HashSet.serialVersionUID
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.LinkedHashMap.accessOrder
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.LinkedHashMap.head
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.LinkedHashMap.serialVersionUID
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.LinkedHashMap.tail
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.LinkedHashSet.serialVersionUID
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.WeakHashMap.DEFAULT_INITIAL_CAPACITY
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.WeakHashMap.DEFAULT_LOAD_FACTOR
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.WeakHashMap.entrySet
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.WeakHashMap.loadFactor
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.WeakHashMap.MAXIMUM_CAPACITY
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.WeakHashMap.modCount
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.WeakHashMap.NULL_KEY
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.WeakHashMap.queue
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.WeakHashMap.size
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.WeakHashMap.table
      WARNING: Illegal reflective access by ...reflection.CachedClass to field java.util.WeakHashMap.threshold
      

      Illegal access exceptions are reported for the methods:

      WARNING: Illegal reflective access by ...reflection.CachedClass to method java.io.File.access$000()
      WARNING: Illegal reflective access by ...reflection.CachedClass to method java.io.File.getPrefixLength()
      WARNING: Illegal reflective access by ...reflection.CachedClass to method java.io.File.isInvalid()
      WARNING: Illegal reflective access by ...reflection.CachedClass to method java.io.File.readObject(java.io.ObjectInputStream)
      WARNING: Illegal reflective access by ...reflection.CachedClass to method java.io.File.slashify(java.lang.String,boolean)
      WARNING: Illegal reflective access by ...reflection.CachedClass to method java.io.File.writeObject(java.io.ObjectOutputStream)
      WARNING: Illegal reflective access by ...reflection.CachedClass to method java.lang.CharSequence.lambda$chars$0()
      WARNING: Illegal reflective access by ...reflection.CachedClass to method java.lang.CharSequence.lambda$codePoints$1()
      WARNING: Illegal reflective access by ...reflection.CachedClass to method java.lang.Class.access$000(java.lang.Class,boolean)
      WARNING: Illegal reflective access by ...reflection.CachedClass to method java.lang.Class.access$100(java.lang.reflect.Field[],java.lang.String)
      

      Attachments

        Issue Links

          Activity

            abayer Andrew Bayer added a comment -

            So this is known - see https://issues.apache.org/jira/browse/GROOVY-8339. It's not technically a problem for Java 9 but will be for Java 18.3. I'm watching that and taking advantage of my Groovy committer status to try to help get the ball rolling.

            abayer Andrew Bayer added a comment - So this is known - see https://issues.apache.org/jira/browse/GROOVY-8339 . It's not technically a problem for Java 9 but will be for Java 18.3. I'm watching that and taking advantage of my Groovy committer status to try to help get the ball rolling.

            abayer quite some time has passed since your last comment, would you happen to know:

            • if this is something something possibly already fixed in Groovy itself
            • and if you know the version/have we bumped to a recent enough version that this issue shouldn't be one anymore?

            Thanks!

            batmat Baptiste Mathus added a comment - abayer quite some time has passed since your last comment, would you happen to know: if this is something something possibly already fixed in Groovy itself and if you know the version/have we bumped to a recent enough version that this issue shouldn't be one anymore? Thanks!
            basil Basil Crow added a comment -

            Still present in Groovy 2.4.21:

            WARNING: An illegal reflective access operation has occurred
            WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/var/cache/jenkins/war/WEB-INF/lib/groovy-all-2.4.21.jar) to method java.lang.Object.finalize()
            WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
            WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
            WARNING: All illegal access operations will be denied in a future release
            
            basil Basil Crow added a comment - Still present in Groovy 2.4.21: WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/var/cache/jenkins/war/WEB-INF/lib/groovy-all-2.4.21.jar) to method java.lang.Object.finalize() WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release
            jetrop Craig Webb added a comment -

            This is preventing us going to Java 17. Is it possible to use Groovy 3.0.X which has the fix?

            jetrop Craig Webb added a comment - This is preventing us going to Java 17. Is it possible to use Groovy 3.0.X which has the fix?
            markewaite Mark Waite added a comment - - edited

            jetrop it isn't feasible to use Groovy 3.0.x in Jenkins at this time. Significant work will be needed before Jenkins can transition from Groovy 2.4.

            Jenkins support for Java 17 is currently in preview. However, you can run your Java builds with Java 17 while still running the Jenkins controller and agents with Java 11.

            markewaite Mark Waite added a comment - - edited jetrop it isn't feasible to use Groovy 3.0.x in Jenkins at this time. Significant work will be needed before Jenkins can transition from Groovy 2.4. Jenkins support for Java 17 is currently in preview. However, you can run your Java builds with Java 17 while still running the Jenkins controller and agents with Java 11.
            basil Basil Crow added a comment -

            This is preventing us going to Java 17

            A non-fatal warning is preventing you from upgrading to Java 17?

            basil Basil Crow added a comment - This is preventing us going to Java 17 A non-fatal warning is preventing you from upgrading to Java 17?

            People

              Unassigned Unassigned
              markewaite Mark Waite
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: