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

[JDK9] Illegal reflective access from jenkins core

      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)
      

          [JENKINS-46618] [JDK9] Illegal reflective access from jenkins core

          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 ?)

           

          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 ?)  

          Jesse Glick added a comment -

          Jesse Glick added a comment - https://github.com/jenkinsci/jenkins/pull/5110

          Jesse Glick added a comment -

          Is this now fixed?

          Jesse Glick added a comment - Is this now fixed?

          Mark Waite added a comment -

          As far as I can tell, this is fixed. I see two illegal reflective access messages in my Java 11 test bed, but neither of them are this message.

          The messages that I see are:

          WARNING: An illegal reflective access operation has occurred
          WARNING: Illegal reflective access by com.thoughtworks.xstream.converters.reflection.FieldDictionary (file:/var/jenkins_home/war/WEB-INF/lib/xstream-1.4.16.jar) to field java.util.Collections$UnmodifiableCollection.serialVersionUID
          WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.converters.reflection.FieldDictionary
          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
          

          The second message is:

          WARNING: An illegal reflective access operation has occurred
          WARNING: Illegal reflective access by com.thoughtworks.xstream.converters.reflection.FieldDictionary (file:/var/jenkins_home/war/WEB-INF/lib/xstream-1.4.16.jar) to field java.util.Collections$UnmodifiableCollection.serialVersionUID
          WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.converters.reflection.FieldDictionary
          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
          

          Mark Waite added a comment - As far as I can tell, this is fixed. I see two illegal reflective access messages in my Java 11 test bed, but neither of them are this message. The messages that I see are: WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.thoughtworks.xstream.converters.reflection.FieldDictionary (file:/ var /jenkins_home/war/WEB-INF/lib/xstream-1.4.16.jar) to field java.util.Collections$UnmodifiableCollection.serialVersionUID WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.converters.reflection.FieldDictionary 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 The second message is: WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.thoughtworks.xstream.converters.reflection.FieldDictionary (file:/ var /jenkins_home/war/WEB-INF/lib/xstream-1.4.16.jar) to field java.util.Collections$UnmodifiableCollection.serialVersionUID WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.converters.reflection.FieldDictionary 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

            Unassigned Unassigned
            markewaite Mark Waite
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: