While upgrading Jenkins to 2.426.2 I am getting below when connecting a node to the Jenkins server

I am using ssh_host_ecdsa_key.pub key instead of ssh_host_rsa_key.pub. Node is connecting and it is online. But want to get rid if this error message. Stuck here for a while. Any suggestions are appreciated.

ERROR: Unexpected error in launching an agent. This is probably a bug in Jenkins Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to r-bld-30 at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1787) at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356) at hudson.remoting.Channel.call(Channel.java:1003) at hudson.FilePath.act(FilePath.java:1283) at org.jenkinsci.plugins.envinject.EnvInjectComputerListener.onOnline(EnvInjectComputerListener.java:144) at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:751) at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:441) at hudson.plugins.sshslaves.SSHLauncher.startAgent(SSHLauncher.java:645) at hudson.plugins.sshslaves.SSHLauncher.lambda$launch$0(SSHLauncher.java:465) java.lang.reflect.InaccessibleObjectException: Unable to make private native java.lang.reflect.Field java.lang.Class.getDeclaredFields0(boolean) accessible: module java.base does not “opens java.lang” to unnamed module @22c71266 at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199) at java.base/java.lang.reflect.Method.setAccessible(Method.java:193) at org.jenkinsci.plugins.envinject.service.EnvInjectMasterEnvVarsSetter.getModifiers(EnvInjectMasterEnvVarsSetter.java:29) at org.jenkinsci.plugins.envinject.service.EnvInjectMasterEnvVarsSetter.call(EnvInjectMasterEnvVarsSetter.java:55) at org.jenkinsci.plugins.envinject.service.EnvInjectMasterEnvVarsSetter.call(EnvInjectMasterEnvVarsSetter.java:19) at hudson.remoting.UserRequest.perform(UserRequest.java:211) at hudson.remoting.UserRequest.perform(UserRequest.java:54) at hudson.remoting.Request$2.run(Request.java:377) at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:840)

Are you on the latest of the EnvInject plugin? It looks like the message is coming from there. So, you either need to upgrade if you haven’t upgraded (though that still may not fix the issue if they haven’t fixed it in the plugin), or remove the plugin from Jenkins (if you aren’t using it anywhere, this is probably the best option).

Thanks Alex for pointing me in the right direction. Looks like it is a bug with JDK11. I am on JDK17 with Jenkins version. Even though I downgraded the plugin to the earlier version I am still seeing the issue.
Steps followed:
Downgraded the plugin to 2.866.v5c0403e3d4df from **[2.908.v66a_774b_31d93] ** and restarted the Jenkins. But still see the issue. Looks like I have to wait for the fix.

(Environment Injector)
https://issues.jenkins.io/browse/JENKINS-72657

If this is an inbound agent you should add an add-opens to the java call
java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED -jar agent.jar ...

for outbound agents (ssh) there is an JVM options field where you should add this
--add-opens java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED

Hi @smuppala,

I think you are supposed to upgrade the EnvInject plugin instead of downgrading it. But it seems like you have already tried the most recent version 2.908.v66a_774b_31d93 (according to Environment Injector). Have you also tried removing that plugin since that plugin has not have a new release in the last 6 months if you are seeing the same error(s) in the stack trace?

Thanks Markus your suggestion helped. I see node is connected without any error message. Thanks a lot. May I know where these things are documented or how you are able to get to this solution?

I don’t know if they’re documented anywhere. I had that same problem after switching one of my Jenkins instances to Java 17. Knowing that in Java 17 the module system was enforced I just searched with Google how to open things up.

Thanks much Marcus. Appreciate your help.