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

Java maven project does not build with JDK 1.8

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Critical Critical
    • maven-plugin
    • None
    • Linux

      I have Jenkins server running on one AWS EC2 instance. I have Cloud build agent configured. the EC2Agent starts when a build is requested. The Jenkins server was running server 2.346.1 with OpenJDK Runtime Environment Corretto-11.0.18.10.1. The agent was running java-1.8.0-amazon-corretto-devel-1.8.0_342.b07-4.

      Our build jobs are mostly maven projects, we support JDK 1.8. Everything worked fine.

      I recently upgraded my Jenkins to 2.375.3. Because the agent can no longer start with JDK 1.8, I had to install JDK 11 to start agent, and still use JDK 1.8 in the job to run the build. Now I am getting the error as below. I checked the jars on the build agent, the jar that causes the problem is /tmp/remoting.jar. It is generated with JDK11, and it is added to the classpath by Jenkins. 
      22:57:11 [TEST-Build-demo1] $ /usr/java/jdk1.8.0_amazon/bin/java -Xmx3072m -Dmaven.repo.local=/var/lib/jenkins/workspace/TEST-Build-demo1/../.m2/repository -Dskip.db=true -Dhttps.protocols=TLSv1.2 -Dant.home=${WORKSPACE}/../um-code-tools/apache-ant-1.9.9 -Dtoolsdir=/var/lib/jenkins/workspace/TEST-Build-demo1/../um-code-tools -Dfbs.base.product.repo.internal=true -cp /var/lib/jenkins/maven35-agent.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.3.9/boot/plexus-classworlds-2.6.0.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.3.9/conf/logging jenkins.maven3.agent.Maven35Main /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.3.9 /tmp/remoting.jar /var/lib/jenkins/maven35-interceptor.jar /var/lib/jenkins/maven3-interceptor-commons.jar 45135

      Below is the error message:
      22:57:11 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*22:57:11* at java.lang.ClassLoader.defineClass1(Native Method)22:57:11 at java.lang.ClassLoader.defineClass(ClassLoader.java:756)22:57:11 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)22:57:11 at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)22:57:11 at java.net.URLClassLoader.access$100(URLClassLoader.java:74)22:57:11 at java.net.URLClassLoader$1.run(URLClassLoader.java:369)22:57:11 at java.net.URLClassLoader$1.run(URLClassLoader.java:363)22:57:11 at java.security.AccessController.doPrivileged(Native Method)22:57:11 at java.net.URLClassLoader.findClass(URLClassLoader.java:362)22:57:11 at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:425)22:57:11 at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)22:57:11 at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)22:57:11 at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)22:57:11 at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)22:57:11 at jenkins.maven3.agent.Maven35Main.main(Maven35Main.java:136)22:57:11 at jenkins.maven3.agent.Maven35Main.main(Maven35Main.java:66)
       

       

            Unassigned Unassigned
            wye W
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: