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

Remoting -fullversion should fail if it finds Java 8

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • ec2-plugin
    • None
    • Jenkins Version: 2.361.1 (LTS)
      org.jenkins-ci.main:remoting:3044.vb_940a_a_e4f72e
      Amazon EC2 plugin: 2.0.2

      When starting an agent Jenkins checks the -fullversion of the java binary and reports this to the console. In 2.361.1 LTS support for Java 8 was removed and the remoting JAR only works with Java 11.

      When checking the java version it could fail fast and produce an appropriate error that leads the user to discover that Java 8 is no longer supported for remoting.

      Currently the remoting jar just fails with the following error message instead:

      Sep 12, 2022 11:02:39 AM hudson.plugins.ec2.EC2Cloud
      INFO: Creating ~/.hudson-run-init
      Sep 12, 2022 11:02:39 AM hudson.plugins.ec2.EC2Cloud
      INFO: Verifying: java -fullversion
      openjdk full version "1.8.0_332-b09"
      Sep 12, 2022 11:02:39 AM hudson.plugins.ec2.EC2Cloud
      INFO: Verifying: which scp
      /usr/bin/scp
      Sep 12, 2022 11:02:39 AM hudson.plugins.ec2.EC2Cloud
      INFO: Copying remoting.jar to: /tmp
      Sep 12, 2022 11:02:40 AM hudson.plugins.ec2.EC2Cloud
      INFO: Launching remoting agent (via SSH client process): ssh -o StrictHostKeyChecking=no -i /tmp/ec2_6766237153533058907.pem jenkins@10.10.102.105 -p 22  java  -jar /tmp/remoting.jar -workDir /home/jenkins
      [09/12/22 11:02:40] Launching agent
      $ ssh -o StrictHostKeyChecking=no -i /tmp/ec2_6766237153533058907.pem jenkins@10.10.102.105 -p 22  java  -jar /tmp/remoting.jar -workDir /home/jenkins
      Warning: Permanently added '10.10.102.105' (ECDSA) to the list of known hosts.
      Error: A JNI error has occurred, please check your installation and try again
      Exception in thread "main" java.lang.UnsupportedClassVersionError: hudson/remoting/Launcher has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
      	at java.lang.ClassLoader.defineClass1(Native Method)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      	at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
      	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
      	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
      	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)
      ERROR: Unable to launch the agent for EC2 (ap-southeast-2) - admin (i-0b7aab3f7d7cc5efd)
      java.io.EOFException: unexpected stream termination
      	at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:459)
      	at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:404)
      	at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:437)
      	at hudson.slaves.CommandLauncher.launch(CommandLauncher.java:170)
      	at hudson.plugins.ec2.ssh.EC2UnixLauncher.launchScript(EC2UnixLauncher.java:270)
      	at hudson.plugins.ec2.EC2ComputerLauncher.launch(EC2ComputerLauncher.java:48)
      	at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:298)
      	at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:48)
      	at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:82)
      	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:829)
      

            jthompson Jeff Thompson
            grogersxyz Geordie Rogers
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: