Selenium plugin issue in Java 11: SSH connection closed

Article ID:360031995252
2 minute readKnowledge base

Issue

  • Selenium plugin connection issues in Java 11: [SSH] Connection closed

  • Selenium plugin prevents Jenkins nodes to launch after upgrading Java to OpenJDK Runtime Environment 11

  • SSH agents fail to launch due to Selenium plugin issues in Java 11

ERROR: Unexpected error in launching a agent. This is probably a bug in Jenkins.
java.lang.NullPointerException
    at hudson.plugins.selenium.PluginImpl.startSeleniumNode(PluginImpl.java:458)

Description

All agents must be running on the same JVM version as the controller (because of how controllers and agents communicate).

Java 8

You can successfully run Selenium plugin on a Jenkins instance on Java 8. SSH agents connect as expected.

Java 11

Nodes fail to launch after upgrading Java version to OpenJDK Runtime Environment 11 on the controller instance. When starting an agent, you expect to see initial connection as expected

[08/08/19 13:37:47] [SSH] Checking java version of java
[08/08/19 13:37:47] [SSH] java -version returned 11.
[08/08/19 13:37:47] [SSH] Starting sftp client.
[08/08/19 13:37:47] [SSH] Copying latest agent.jar...
[08/08/19 13:37:47] [SSH] Copied 789,283 bytes.
Expanded the channel window size to 4MB
[08/08/19 13:37:47] [SSH] Starting agent process: cd "/home/agent" && java  -jar agent.jar
<===[JENKINS REMOTING CAPACITY]===>channel started
Remoting version: 3.29
This is a Unix agent

However, the node fails to launch due to Selenium plugin installed on the controller instance. The error is similar to

setting up agent node1 ...
slave setup done.
ERROR: Unexpected error in launching a agent. This is probably a bug in Jenkins.
java.lang.NullPointerException
    at hudson.plugins.selenium.PluginImpl.startSeleniumNode(PluginImpl.java:458)
    at hudson.plugins.selenium.ComputerListenerImpl.onOnline(ComputerListenerImpl.java:30)
    at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:697)
    at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:432)
    at hudson.plugins.sshslaves.SSHLauncher.startSlave(SSHLauncher.java:1110)
    at hudson.plugins.sshslaves.SSHLauncher.access$500(SSHLauncher.java:148)
    at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:845)
    at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:820)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
[08/08/19 13:37:48] Launch failed - cleaning up connection
[08/08/19 13:37:48] [SSH] Connection closed.
ERROR: Connection terminated

Resolution

As of August 2019 the Selenium plugin requires Java 8, and is not yet compatible with Java 11.

Check plugin README.md for further updates.

If you need to run Jenkins controller instance on Java 11, then disable the Selenium plugin.