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

tip

Update "latest" to Java 8 on DockerHub.

tip

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.

tip

You're using an older version of java with classes compiled for java7

tip

If you're using intellij plugin of sonarqube, you might have to set the JAVA_HOME ambient variable manually.

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • Greetings, I have upgraded my Jenkins server at home using the latest 1.399 WAR with the intention to fix #JENKINS-8647 (growing log files due to an issue in JmDNS) but it seems that the compatibility with Java 5 is broken by jmdns-3.4.0.jar I get the following stack trace in my catalina.log at server initialization: {noformat}---------- 28 févr. 2011 22:59:49 hudson.WebAppMain$2 run GRAVE: Failed to initialize Hudson 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 org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1853) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:875) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1330) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1209) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at hudson.DNSMultiCast.<init>(DNSMultiCast.java:26) at hudson.model.Hudson.<init>(Hudson.java:691) at hudson.model.Hudson.<init>(Hudson.java:605) at hudson.WebAppMain$2.run(WebAppMain.java:221) ----------{noformat} I will try to build JmDNS 3.4.0 with a Java 5 JDK and see if it fixes the issue. I believe this should be patched in the next release, I might not be the last person stuck with Java 5 :) Thanks & regards, --JB.L
    via by Jean-Baptiste Lièvremont,
  • Greetings, I have upgraded my Jenkins server at home using the latest 1.399 WAR with the intention to fix #JENKINS-8647 (growing log files due to an issue in JmDNS) but it seems that the compatibility with Java 5 is broken by jmdns-3.4.0.jar I get the following stack trace in my catalina.log at server initialization: {noformat}---------- 28 févr. 2011 22:59:49 hudson.WebAppMain$2 run GRAVE: Failed to initialize Hudson 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 org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1853) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:875) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1330) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1209) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at hudson.DNSMultiCast.<init>(DNSMultiCast.java:26) at hudson.model.Hudson.<init>(Hudson.java:691) at hudson.model.Hudson.<init>(Hudson.java:605) at hudson.WebAppMain$2.run(WebAppMain.java:221) ----------{noformat} I will try to build JmDNS 3.4.0 with a Java 5 JDK and see if it fixes the issue. I believe this should be patched in the next release, I might not be the last person stuck with Java 5 :) Thanks & regards, --JB.L
    via by Jean-Baptiste Lièvremont,
  • Unsupported class version error in java?
    via Stack Overflow by Anil M
    ,
  • How to use guava-18.0.jar in Liferay 5.2.3
    via by Unknown author,
  • Bad version number in .class file
    via by phil...@gmail.com,
  • The method createFlowApplicationContext() in org.springframework.webflow.engine.builder.xml.XmlFlowBuilder tries to register AnnotationConfigProcessors, but Annotations are available from JDK1.5 onward. This results in the following Exception: java.lang.UnsupportedClassVersionError: org/springframework/context/annotation/AnnotationConfigUtils (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1852) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:876) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1208) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at org.springframework.webflow.engine.builder.xml.XmlFlowBuilder.createFlowApplicationContext(XmlFlowBuilder.java:330) at org.springframework.webflow.engine.builder.xml.XmlFlowBuilder.initLocalFlowContext(XmlFlowBuilder.java:305) at org.springframework.webflow.engine.builder.xml.XmlFlowBuilder.doInit(XmlFlowBuilder.java:172) at org.springframework.webflow.engine.builder.support.AbstractFlowBuilder.init(AbstractFlowBuilder.java:54) at org.springframework.webflow.engine.builder.FlowAssembler.assembleFlow(FlowAssembler.java:90) at org.springframework.webflow.engine.builder.RefreshableFlowDefinitionHolder.assembleFlow(RefreshableFlowDefinitionHolder.java:127) at org.springframework.webflow.engine.builder.RefreshableFlowDefinitionHolder.getFlowDefinition(RefreshableFlowDefinitionHolder.java:88) at org.springframework.webflow.definition.registry.FlowDefinitionRegistryImpl.getFlowDefinition(FlowDefinitionRegistryImpl.java:61) at org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:110) at org.springframework.webflow.mvc.FlowController.handleRequestInternal(FlowController.java:80) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441) ...
    via by Udo Wagner,
  • The method createFlowApplicationContext() in org.springframework.webflow.engine.builder.xml.XmlFlowBuilder tries to register AnnotationConfigProcessors, but Annotations are available from JDK1.5 onward. This results in the following Exception: java.lang.UnsupportedClassVersionError: org/springframework/context/annotation/AnnotationConfigUtils (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1852) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:876) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1208) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at org.springframework.webflow.engine.builder.xml.XmlFlowBuilder.createFlowApplicationContext(XmlFlowBuilder.java:330) at org.springframework.webflow.engine.builder.xml.XmlFlowBuilder.initLocalFlowContext(XmlFlowBuilder.java:305) at org.springframework.webflow.engine.builder.xml.XmlFlowBuilder.doInit(XmlFlowBuilder.java:172) at org.springframework.webflow.engine.builder.support.AbstractFlowBuilder.init(AbstractFlowBuilder.java:54) at org.springframework.webflow.engine.builder.FlowAssembler.assembleFlow(FlowAssembler.java:90) at org.springframework.webflow.engine.builder.RefreshableFlowDefinitionHolder.assembleFlow(RefreshableFlowDefinitionHolder.java:127) at org.springframework.webflow.engine.builder.RefreshableFlowDefinitionHolder.getFlowDefinition(RefreshableFlowDefinitionHolder.java:88) at org.springframework.webflow.definition.registry.FlowDefinitionRegistryImpl.getFlowDefinition(FlowDefinitionRegistryImpl.java:61) at org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:110) at org.springframework.webflow.mvc.FlowController.handleRequestInternal(FlowController.java:80) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441) ...
    via by Udo Wagner,
  • java.lang.reflect.InvocationTargetException
    via by Migrated From Jforum.net,
    • 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 org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1853) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:875) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1330) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1209) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at hudson.DNSMultiCast.<init>(DNSMultiCast.java:26) at hudson.model.Hudson.<init>(Hudson.java:691) at hudson.model.Hudson.<init>(Hudson.java:605) at hudson.WebAppMain$2.run(WebAppMain.java:221)

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    196 more bugmates