-
Bug
-
Resolution: Fixed
-
Major
-
Server:
Debian 10 x64
OpenJDK 11 (build 11.0.12+7-post-Debian-2deb10u1)
Jenkins 2.303.2
EnvInject plugin 2.4.0
Agent:
macOS Big Sur 11.6 x64
OpenJDK 15 (build 15+36-1562)
-
-
2.875.v9b_9e962da_a_ec
https://github.com/jenkinsci/envinject-plugin/blob/f72ef372efdef8791a175f1c121e067c10da40a6/src/main/java/org/jenkinsci/plugins/envinject/service/EnvInjectMasterEnvVarsSetter.java#L35 uses Field.class.getDeclaredField("modifiers") to remove the "final" modifier from the static field EnvVars.masterEnvVars (https://github.com/jenkinsci/jenkins/blob/f23512f2bc97d18cd4f0183a7db4a62bc6b84196/core/src/main/java/hudson/EnvVars.java#L459). This method is no longer working on OpenJDK 12+.
The change in JDK 12 is intentional to improve the robustness and security of the platform. In general, there is no supported way to change static final fields.
This error can be seen in the logs as:
onOnline: class org.jenkinsci.plugins.envinject.EnvInjectComputerListener reported an exception: java.io.IOException: org.jenkinsci.lib.envinject.EnvInjectException: java.lang.NoSuchFieldException: modifiers