0

I am facing a problem starting jenkins after an update on an Linux EC2 Instance. There was an older version of Java installed and i updated using yum command

    sudo systemctl status jenkins.service
    ● jenkins.service - Jenkins Continuous Integration Server
       Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; vendor preset: disabled)
       Active: failed (Result: start-limit) since Fri 2024-06-28 20:07:46 BST; 2min 0s ago
      Process: 4671 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
     Main PID: 4671 (code=exited, status=1/FAILURE)
    
    Jun 28 20:07:46 ip-172-31-28-49.eu-west-1.compute.internal systemd[1]: jenkins.service: main process exited, code=exited, status=1/FAILURE
    Jun 28 20:07:46 ip-172-31-28-49.eu-west-1.compute.internal systemd[1]: Failed to start Jenkins Continuous Integration Server.
    Jun 28 20:07:46 ip-172-31-28-49.eu-west-1.compute.internal systemd[1]: Unit jenkins.service entered failed state.
    Jun 28 20:07:46 ip-172-31-28-49.eu-west-1.compute.internal systemd[1]: jenkins.service failed.
    Jun 28 20:07:46 ip-172-31-28-49.eu-west-1.compute.internal systemd[1]: jenkins.service holdoff time over, scheduling restart.
    Jun 28 20:07:46 ip-172-31-28-49.eu-west-1.compute.internal systemd[1]: start request repeated too quickly for jenkins.service
    Jun 28 20:07:46 ip-172-31-28-49.eu-west-1.compute.internal systemd[1]: Failed to start Jenkins Continuous Integration Server.
    Jun 28 20:07:46 ip-172-31-28-49.eu-west-1.compute.internal systemd[1]: Unit jenkins.service entered failed state.
    Jun 28 20:07:46 ip-172-31-28-49.eu-west-1.compute.internal systemd[1]: jenkins.service failed.

The java version details

java --version
openjdk 11.0.23 2024-04-16 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.23.0.9-2.amzn2.0.1) (build 11.0.23+9-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.23.0.9-2.amzn2.0.1) (build 11.0.23+9-LTS, mixed mode, sharing)

When i run the jenkins version command i get the below error

jenkins -version
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: executable/Main 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:468)
    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:495)

I assumed that this was a Java issue so i tried installing the below Java versions i.e.

There is 3 program that provides 'java'.

  Selection    Command
-----------------------------------------------
   1           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.amzn2.0.1.x86_64/jre/bin/java)
*  2           /usr/lib/jvm/java-17-amazon-corretto.x86_64/bin/java
 + 3           java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.23.0.9-2.amzn2.0.1.x86_64/bin/java)

Just ran which jenkins and it returns /usr/bin/jenkins

New contributor
i.am.it is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
1
  • 1
    so the error from jenkins --version is indicating that jenkins is running with java8 (v52), not java11 (v55). can you remove the java-1.8.0-openjdk.x86_64 ? Commented 13 hours ago

0

You must log in to answer this question.

Browse other questions tagged .