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

[JDK9] Illegal reflective access from jenkins core

    Details

    • Similar Issues:

      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 jenkins.ClassLoaderReflectionToolkit (file:/var/jenkins_home/war/WEB-INF/lib/jenkins-core-2.60.3.jar) to method java.lang.ClassLoader.findClass(java.lang.String)
              at jenkins.ClassLoaderReflectionToolkit.<clinit>(ClassLoaderReflectionToolkit.java:22)
              at hudson.ClassicPluginStrategy$DependencyClassLoader.findClass(ClassicPluginStrategy.java:762)
              at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
              at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
              at jenkins.util.AntClassLoader.findBaseClass(AntClassLoader.java:1393)
              at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1076)
              at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
              at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:506)
              at hudson.PluginManager$2$1$1.run(PluginManager.java:517)
              at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
              at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
              at jenkins.model.Jenkins$7.runTask(Jenkins.java:1090)
              at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
              at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
              at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
              at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
              at java.base/java.lang.Thread.run(Thread.java:844)
      

        Attachments

          Activity

          markewaite Mark Waite created issue -
          markewaite Mark Waite made changes -
          Field Original Value New Value
          Epic Link JENKINS-40689 [ 177392 ]
          markewaite Mark Waite made changes -
          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:

          {noformat}
          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)
          {noformat}

          The stack trace seems to appear any time I try to run a pipeline job, and any time
          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:

          {noformat}
          WARNING: Illegal reflective access by jenkins.ClassLoaderReflectionToolkit (file:/var/jenkins_home/war/WEB-INF/lib/jenkins-core-2.60.3.jar) to method java.lang.ClassLoader.findClass(java.lang.String)
                  at jenkins.ClassLoaderReflectionToolkit.<clinit>(ClassLoaderReflectionToolkit.java:22)
                  at hudson.ClassicPluginStrategy$DependencyClassLoader.findClass(ClassicPluginStrategy.java:762)
                  at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
                  at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
                  at jenkins.util.AntClassLoader.findBaseClass(AntClassLoader.java:1393)
                  at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1076)
                  at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
                  at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:506)
                  at hudson.PluginManager$2$1$1.run(PluginManager.java:517)
                  at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
                  at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
                  at jenkins.model.Jenkins$7.runTask(Jenkins.java:1090)
                  at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
                  at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
                  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
                  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
                  at java.base/java.lang.Thread.run(Thread.java:844)
          {noformat}

          markewaite Mark Waite made changes -
          Summary JDK9] Illegal reflective access from jenkins core [JDK9] Illegal reflective access from jenkins core
          oleg_nenashev Oleg Nenashev made changes -
          Labels java10_hackathon newbie-friendly
          Hide
          ndeloof Nicolas De Loof added a comment -

          This whole thing has been introduced by https://github.com/jenkinsci/jenkins/commit/ee4e9c61491e89e7879337279bc58f85eb9048d1#diff-6fcbca8847b7ec9ab582a1a7e253a34a

          Unfortunately hack-ish and hard for us to find an alternative implementation.

          ALL calls to ClassLoaderReflectionToolkit come with alternative classic approach based on PluginManager.FAST_LOOKUP flag. So maybe simpler|safer to just remove this whole thing ? Not sure how "faster" this hack is vs plain classloader (especially if we consider the target classes will be loaded at some point, won't they ?)

           

          Show
          ndeloof Nicolas De Loof added a comment - This whole thing has been introduced by https://github.com/jenkinsci/jenkins/commit/ee4e9c61491e89e7879337279bc58f85eb9048d1#diff-6fcbca8847b7ec9ab582a1a7e253a34a Unfortunately hack-ish and hard for us to find an alternative implementation. ALL calls to ClassLoaderReflectionToolkit come with alternative classic approach based on PluginManager.FAST_LOOKUP flag. So maybe simpler|safer to just remove this whole thing ? Not sure how "faster" this hack is vs plain classloader (especially if we consider the target classes will be loaded at some point, won't they ?)  
          oleg_nenashev Oleg Nenashev made changes -
          Labels java10_hackathon newbie-friendly java10_hackathon java11 newbie-friendly
          batmat Baptiste Mathus made changes -
          Labels java10_hackathon java11 newbie-friendly illegalReflectiveAccess java10_hackathon java11 newbie-friendly
          batmat Baptiste Mathus made changes -
          Labels illegalReflectiveAccess java10_hackathon java11 newbie-friendly illegalReflectiveAccess java10_hackathon java11 newbie-friendly triaged

            People

            • Assignee:
              Unassigned
              Reporter:
              markewaite Mark Waite
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: