java.lang.UnsupportedClassVersionError: Bad version number in .class file

Jenkins JIRA | Andreas Mandel | 2 years ago
  1. 0

    The issue described in JENKINS-18403 appears again in Jenkins 1.565.3 (works fine in 1.565.2) Running a Maven build with an 1.5 JDK fails. The automatic JDK switch implemented to fix JENKINS-18403 does not seem to kick in: {code} Parsing POMs [my-job-trunk] $ /export/sbs/jenkins/home/tools/hudson.model.JDK/jdk-1.5.0.22/bin/java -cp /export/sbs/jenkins/home/plugins/maven-plugin/WEB-INF/lib/maven31-agent-1.5.jar:/export/sbs/jenkins/home/tools/hudson.tasks.Maven_MavenInstallation/maven-3.1.x/boot/plexus-classworlds-2.5.1.jar:/export/sbs/jenkins/home/tools/hudson.tasks.Maven_MavenInstallation/maven-3.1.x/conf/logging jenkins.maven3.agent.Maven31Main /export/sbs/jenkins/home/tools/hudson.tasks.Maven_MavenInstallation/maven-3.1.x /run/jenkins/war/WEB-INF/lib/remoting-2.46.jar /export/sbs/jenkins/home/plugins/maven-plugin/WEB-INF/lib/maven31-interceptor-1.5.jar /export/sbs/jenkins/home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.5.jar 41235 Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) 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.Maven31Main.main(Maven31Main.java:138) at jenkins.maven3.agent.Maven31Main.main(Maven31Main.java:67) ERROR: Failed to parse POMs java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:196) at java.net.SocketInputStream.read(SocketInputStream.java:122) at java.io.FilterInputStream.read(FilterInputStream.java:133) at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) at java.io.BufferedInputStream.read(BufferedInputStream.java:254) at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:198) at hudson.remoting.Channel.<init>(Channel.java:418) at hudson.remoting.Channel.<init>(Channel.java:397) at hudson.remoting.Channel.<init>(Channel.java:393) at hudson.remoting.Channel.<init>(Channel.java:382) at hudson.remoting.Channel.<init>(Channel.java:374) at hudson.remoting.Channel.<init>(Channel.java:366) at hudson.slaves.Channels$1.<init>(Channels.java:70) at hudson.slaves.Channels.forProcess(Channels.java:70) at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:280) at hudson.maven.ProcessCache.get(ProcessCache.java:235) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:755) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529) at hudson.model.Run.execute(Run.java:1706) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:232) [description-setter] Description set: Skipping sonar analysis due to bad build status FAILURE {code}

    Jenkins JIRA | 2 years ago | Andreas Mandel
    java.lang.UnsupportedClassVersionError: Bad version number in .class file
  2. 0

    The issue described in JENKINS-18403 appears again in Jenkins 1.565.3 (works fine in 1.565.2) Running a Maven build with an 1.5 JDK fails. The automatic JDK switch implemented to fix JENKINS-18403 does not seem to kick in: {code} Parsing POMs [my-job-trunk] $ /export/sbs/jenkins/home/tools/hudson.model.JDK/jdk-1.5.0.22/bin/java -cp /export/sbs/jenkins/home/plugins/maven-plugin/WEB-INF/lib/maven31-agent-1.5.jar:/export/sbs/jenkins/home/tools/hudson.tasks.Maven_MavenInstallation/maven-3.1.x/boot/plexus-classworlds-2.5.1.jar:/export/sbs/jenkins/home/tools/hudson.tasks.Maven_MavenInstallation/maven-3.1.x/conf/logging jenkins.maven3.agent.Maven31Main /export/sbs/jenkins/home/tools/hudson.tasks.Maven_MavenInstallation/maven-3.1.x /run/jenkins/war/WEB-INF/lib/remoting-2.46.jar /export/sbs/jenkins/home/plugins/maven-plugin/WEB-INF/lib/maven31-interceptor-1.5.jar /export/sbs/jenkins/home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.5.jar 41235 Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) 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.Maven31Main.main(Maven31Main.java:138) at jenkins.maven3.agent.Maven31Main.main(Maven31Main.java:67) ERROR: Failed to parse POMs java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:196) at java.net.SocketInputStream.read(SocketInputStream.java:122) at java.io.FilterInputStream.read(FilterInputStream.java:133) at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) at java.io.BufferedInputStream.read(BufferedInputStream.java:254) at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:198) at hudson.remoting.Channel.<init>(Channel.java:418) at hudson.remoting.Channel.<init>(Channel.java:397) at hudson.remoting.Channel.<init>(Channel.java:393) at hudson.remoting.Channel.<init>(Channel.java:382) at hudson.remoting.Channel.<init>(Channel.java:374) at hudson.remoting.Channel.<init>(Channel.java:366) at hudson.slaves.Channels$1.<init>(Channels.java:70) at hudson.slaves.Channels.forProcess(Channels.java:70) at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:280) at hudson.maven.ProcessCache.get(ProcessCache.java:235) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:755) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529) at hudson.model.Run.execute(Run.java:1706) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:232) [description-setter] Description set: Skipping sonar analysis due to bad build status FAILURE {code}

    Jenkins JIRA | 2 years ago | Andreas Mandel
    java.lang.UnsupportedClassVersionError: Bad version number in .class file
  3. 0

    Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file in Jenkins

    Stack Overflow | 2 years ago | Ganesh
    java.lang.UnsupportedClassVersionError: Bad version number in .class file
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0
    This might be caused by and outdated version of Java, SonarQube now uses Java 8 as default. You might upgrade java or use an older version of SonarQube.
  6. 0

    Bad version number in .class file after upgrading Sonar to 3.6

    Stack Overflow | 4 years ago | lweller
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project uno: Can not execute Sonar

  1. Rafael Fischer Viola 1 times, last 5 days ago
  2. andyglick 3 times, last 1 month ago
34 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.UnsupportedClassVersionError

    Bad version number in .class file

    at java.lang.ClassLoader.defineClass1()
  2. Java RT
    URLClassLoader.findClass
    1. java.lang.ClassLoader.defineClass1(Native Method)
    2. java.lang.ClassLoader.defineClass(ClassLoader.java:621)
    3. java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    4. java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    5. java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    6. java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    7. java.security.AccessController.doPrivileged(Native Method)
    8. java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    8 frames
  3. Plexus
    ClassRealm.loadClass
    1. org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:389)
    2. org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
    3. org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
    4. org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:242)
    5. org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
    5 frames
  4. jenkins.maven3.agent
    Maven31Main.main
    1. jenkins.maven3.agent.Maven31Main.main(Maven31Main.java:138)
    2. jenkins.maven3.agent.Maven31Main.main(Maven31Main.java:67)
    2 frames