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

UnsupportedClassVersionError when using JDK6

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Hi Guys,

      we recently upgraded our jenkins from 2.19.4 LTS to 2.32.1 LTS and we are facing an issue in jobs using JDK 6.

      If I run in master the exception below occours but the job succeds:

      Established TCP socket on 43500
      [spj-deploy-fabrica] $ /opt/jenkins-java/jdk1.6/bin/java -Duser.timezone=GMT-03:00 -Djavax.net.ssl.trustStore=/opt/security/cacert.jks -Djavax.net.ssl.trustStorePassword=jb05%c@c3rtP@5%w0rd -cp /var/procergs/build-tools/jenkins/plugins/maven-plugin/WEB-INF/lib/maven32-agent-1.8.1.jar:/opt/apache-maven-3/boot/plexus-classworlds-2.5.1.jar:/opt/apache-maven-3/conf/logging jenkins.maven3.agent.Maven32Main /opt/apache-maven-3 /opt/jboss-eap-7.0/domain/servers/JENKINS/tmp/vfs/temp/temp2beba3780575b554/content-1dac40c08d58316e/WEB-INF/lib/remoting-3.2.jar /var/procergs/build-tools/jenkins/plugins/maven-plugin/WEB-INF/lib/maven32-interceptor-1.8.1.jar /var/procergs/build-tools/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.8.1.jar 43500
      Exception in thread "main" java.lang.UnsupportedClassVersionError: hudson/remoting/Launcher : Unsupported major.minor version 51.0
      	at java.lang.ClassLoader.defineClass1(Native Method)
      	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
      	at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
      	at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:389)
      	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:242)
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
      	at jenkins.maven3.agent.Maven32Main.main(Maven32Main.java:143)
      	at jenkins.maven3.agent.Maven32Main.main(Maven32Main.java:74)
      ERROR: ================================================================================
      ERROR: Invalid project setup: Connection reset
      ERROR: [JENKINS-18403][JENKINS-28294] JDK 'jdk1.6.0_27' not supported to run Maven projects.
      ERROR: Maven projects have to be launched with a Java version greater or equal to the minimum version required by the master.
      ERROR: Use the Maven JDK Toolchains (plugin) to build your maven project with an older JDK.
      ERROR: Retrying with slave Java and setting compile/test properties to point to /opt/jenkins-java/jdk1.6.
      ERROR: ================================================================================
      Established TCP socket on 48365
      [spj-deploy-fabrica] $ /opt/java/jdk1.8.0_91/jre/bin/java -Duser.timezone=GMT-03:00 -Djavax.net.ssl.trustStore=/opt/security/cacert.jks -Djavax.net.ssl.trustStorePassword=jb05%c@c3rtP@5%w0rd -cp /var/procergs/build-tools/jenkins/plugins/maven-plugin/WEB-INF/lib/maven32-agent-1.8.1.jar:/opt/apache-maven-3/boot/plexus-classworlds-2.5.1.jar:/opt/apache-maven-3/conf/logging jenkins.maven3.agent.Maven32Main /opt/apache-maven-3 /opt/jboss-eap-7.0/domain/servers/JENKINS/tmp/vfs/temp/temp2beba3780575b554/content-1dac40c08d58316e/WEB-INF/lib/remoting-3.2.jar /var/procergs/build-tools/jenkins/plugins/maven-plugin/WEB-INF/lib/maven32-interceptor-1.8.1.jar /var/procergs/build-tools/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.8.1.jar 48365
      <===[JENKINS REMOTING CAPACITY]===>channel started
      

      But when it runs on a slave it fails:

      Established TCP socket on 41401
      maven32-agent.jar already up to date
      maven32-interceptor.jar already up to date
      maven3-interceptor-commons.jar already up to date
      [spj-deploy-fabrica] $ /opt/jenkins-java/jdk1.6/bin/java -Duser.timezone=GMT-03:00 -Djavax.net.ssl.trustStore=/opt/security/cacert.jks -Djavax.net.ssl.trustStorePassword=jb05%c@c3rtP@5%w0rd -cp /home/procergs/jboss/jenkins-slave/maven32-agent.jar:/opt/apache-maven-3/boot/plexus-classworlds-2.5.1.jar:/opt/apache-maven-3/conf/logging jenkins.maven3.agent.Maven32Main /opt/apache-maven-3 /home/procergs/jboss/jenkins-slave/slave.jar /home/procergs/jboss/jenkins-slave/maven32-interceptor.jar /home/procergs/jboss/jenkins-slave/maven3-interceptor-commons.jar 41401
      Exception in thread "main" java.lang.UnsupportedClassVersionError: hudson/remoting/Launcher : Unsupported major.minor version 51.0
      	at java.lang.ClassLoader.defineClass1(Native Method)
      	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
      	at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
      	at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:389)
      	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:242)
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
      	at jenkins.maven3.agent.Maven32Main.main(Maven32Main.java:143)
      	at jenkins.maven3.agent.Maven32Main.main(Maven32Main.java:74)
      [spj-deploy-fabrica] $ /bin/sh -xe /tmp/hudson4749605600898410228.sh
      + cp spj-ear/target/spj.ear /weblogic/beades/user_projects/domains//dom_xpj_004_w10/autodeploy
      cp: cannot stat 'spj-ear/target/spj.ear': No such file or directory
      Build step 'Executar shell' marked build as failure
      ERROR: Falhou ao analisar POMs
      java.io.EOFException: unexpected stream termination
      	at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:365)
      	at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:310)
      	at hudson.slaves.Channels.forProcess(Channels.java:115)
      	at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:294)
      	at hudson.maven.ProcessCache.get(ProcessCache.java:236)
      	at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:798)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
      	at hudson.model.Run.execute(Run.java:1728)
      	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:544)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:404)
      Started calculate disk usage of build
      Finished Calculation of disk usage of build in 0 seconds
      Started calculate disk usage of workspace
      Finished Calculation of disk usage of workspace in  2 second
      Finished: FAILURE
      

      I don't know if it is related but there was a recent change in remoting in 2.27 (see JENKINS-37565)

        Attachments

          Issue Links

            Activity

            Hide
            rmpestano Rafael Pestano added a comment - - edited

            User error, the slave cannot access a file to execute a shell copy:

            cp: cannot stat 'spj-ear/target/spj.ear': No such file or directory

            The only strange thing is the UnsupportedClassVersionError but it doesn't affect job execution.

            Show
            rmpestano Rafael Pestano added a comment - - edited User error, the slave cannot access a file to execute a shell copy: cp: cannot stat 'spj-ear/target/spj.ear': No such file or directory The only strange thing is the UnsupportedClassVersionError but it doesn't affect job execution.
            Hide
            rmpestano Rafael Pestano added a comment - - edited

            What we noticed is that the build phase is skipped on slave and that's why we got a 'No such file or directory' (the shell script runs on a post step that is marked as 'run only if build succeds') because the binaries are generated at 'build' phase which was skipped (only on slave).

            Any hints?

            Show
            rmpestano Rafael Pestano added a comment - - edited What we noticed is that the build phase is skipped on slave and that's why we got a 'No such file or directory' (the shell script runs on a post step that is marked as 'run only if build succeds') because the binaries are generated at 'build' phase which was skipped (only on slave). Any hints?
            Hide
            danielbeck Daniel Beck added a comment -

            I recommend you change your trust store password. You've published it above.

            JDK 6 is no longer supported for Maven projects as the error message clearly indicates. Use toolchains to build on JDK 6 and older instead.

            Oleg Nenashev Could you confirm what I'm writing here?

            Show
            danielbeck Daniel Beck added a comment - I recommend you change your trust store password. You've published it above. JDK 6 is no longer supported for Maven projects as the error message clearly indicates. Use toolchains to build on JDK 6 and older instead. Oleg Nenashev Could you confirm what I'm writing here?
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            Yes, Java 6 is no longer supported in Remoting since 3.0. It impacts all Remoting-dependent plugins including Maven Project Plugin.

            Jenkins core does not support JDK6 since 1.610, so it was just a question of time when the Maven project plugin fails.

            Maybe it worth mentioning it in the Maven Project Plugin Wiki.

            Show
            oleg_nenashev Oleg Nenashev added a comment - Yes, Java 6 is no longer supported in Remoting since 3.0. It impacts all Remoting-dependent plugins including Maven Project Plugin. Jenkins core does not support JDK6 since 1.610, so it was just a question of time when the Maven project plugin fails. Maybe it worth mentioning it in the Maven Project Plugin Wiki.
            Hide
            rmpestano Rafael Pestano added a comment -

            Ok, thank you guys for the info.

            Show
            rmpestano Rafael Pestano added a comment - Ok, thank you guys for the info.
            Hide
            danielbeck Daniel Beck added a comment -

            I'm adding some documentation for it in https://github.com/jenkins-infra/jenkins.io/pull/554

            Show
            danielbeck Daniel Beck added a comment - I'm adding some documentation for it in https://github.com/jenkins-infra/jenkins.io/pull/554
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Daniel Beck
            Path:
            content/changelog-stable/index.html
            content/doc/upgrade-guide/2.32.adoc
            http://jenkins-ci.org/commit/jenkins.io/1692ba554089a4281a8407372a51af5c3ef19db6
            Log:
            JENKINS-40810 Mention effect of Remoting 3 on Maven builds

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: content/changelog-stable/index.html content/doc/upgrade-guide/2.32.adoc http://jenkins-ci.org/commit/jenkins.io/1692ba554089a4281a8407372a51af5c3ef19db6 Log: JENKINS-40810 Mention effect of Remoting 3 on Maven builds
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Daniel Beck
            Path:
            content/changelog-stable/index.html
            http://jenkins-ci.org/commit/jenkins.io/39718b18cb7c201a6ce6d37b541e7736c3b8fc2b
            Log:
            JENKINS-40810 Make Java requirement explicit

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: content/changelog-stable/index.html http://jenkins-ci.org/commit/jenkins.io/39718b18cb7c201a6ce6d37b541e7736c3b8fc2b Log: JENKINS-40810 Make Java requirement explicit
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: R. Tyler Croy
            Path:
            content/changelog-stable/index.html
            content/doc/upgrade-guide/2.32.adoc
            http://jenkins-ci.org/commit/jenkins.io/7dc33503c5af2c7be284927e78ca2d3c9870761b
            Log:
            Merge pull request #554 from daniel-beck/JENKINS-40810

            JENKINS-40810 Mention effect of Remoting 3 on Maven builds

            Compare: https://github.com/jenkins-infra/jenkins.io/compare/294071086e58...7dc33503c5af

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: R. Tyler Croy Path: content/changelog-stable/index.html content/doc/upgrade-guide/2.32.adoc http://jenkins-ci.org/commit/jenkins.io/7dc33503c5af2c7be284927e78ca2d3c9870761b Log: Merge pull request #554 from daniel-beck/ JENKINS-40810 JENKINS-40810 Mention effect of Remoting 3 on Maven builds Compare: https://github.com/jenkins-infra/jenkins.io/compare/294071086e58...7dc33503c5af

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              rmpestano Rafael Pestano
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: