Unsupported major.minor version 52.0

Posted 雪儿

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Unsupported major.minor version 52.0相关的知识,希望对你有一定的参考价值。

大概的意思是项目在eclipce中是用1.8编译的,服务器上使用的1.7,所以会报错
解决:把本地的jdk和jre改为1.7,在eclipce中引用1.7的jdk和jre重新clean项目,运行没错,

    然后打成war包发到服务器上,这时的项目是用1.7编译的,和服务器上jdk版本一致,所以运行就正常了

下面是异常代码:

七月 24, 2017 3:42:28 下午 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
七月 24, 2017 3:42:28 下午 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-58181
七月 24, 2017 3:42:28 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 630 ms
七月 24, 2017 3:42:28 下午 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
七月 24, 2017 3:42:28 下午 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.37
七月 24, 2017 3:42:28 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory hunanidcalarm
七月 24, 2017 3:42:28 下午 org.apache.catalina.loader.WebappClassLoader validateJarFile
信息: validateJarFile(/opt/NmsAPP/Ultra-CUAlarm/webapps/hunanidcalarm/WEB-INF/lib/javax.servlet-api-3.1.0.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
2017/07/24 15:42:29 INFO  ContextLoader  Root WebApplicationContext: initialization started
2017/07/24 15:42:30 INFO  AbstractApplicationContext  Refreshing Root WebApplicationContext: startup date [Mon Jul 24 15:42:30 CST 2017]; root of context hierarchy
2017/07/24 15:42:30 INFO  XmlBeanDefinitionReader  Loading XML bean definitions from class path resource [conf/applicationContext.xml]
2017/07/24 15:42:30 WARN  AbstractApplicationContext  Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [com.ultrapower.hunan.lvwangwebserver.service.impl.LvWangServiceImpl] for bean with name ‘lvWangServiceImpl‘ defined in file [/opt/NmsAPP/Ultra-CUAlarm/webapps/hunanidcalarm/WEB-INF/classes/com/ultrapower/hunan/lvwangwebserver/service/impl/LvWangServiceImpl.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: com/ultrapower/hunan/lvwangwebserver/service/impl/LvWangServiceImpl : Unsupported major.minor version 52.0 (unable to load class com.ultrapower.hunan.lvwangwebserver.service.impl.LvWangServiceImpl)
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1331)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:622)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:591)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1397)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:968)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:735)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:434)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.UnsupportedClassVersionError: com/ultrapower/hunan/lvwangwebserver/service/impl/LvWangServiceImpl : Unsupported major.minor version 52.0 (unable to load class com.ultrapower.hunan.lvwangwebserver.service.impl.LvWangServiceImpl)
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2858)
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:249)
    at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:395)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1349)
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1320)
    ... 34 more
2017/07/24 15:42:30 ERROR ContextLoader  Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [com.ultrapower.hunan.lvwangwebserver.service.impl.LvWangServiceImpl] for bean with name ‘lvWangServiceImpl‘ defined in file [/opt/NmsAPP/Ultra-CUAlarm/webapps/hunanidcalarm/WEB-INF/classes/com/ultrapower/hunan/lvwangwebserver/service/impl/LvWangServiceImpl.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: com/ultrapower/hunan/lvwangwebserver/service/impl/LvWangServiceImpl : Unsupported major.minor version 52.0 (unable to load class com.ultrapower.hunan.lvwangwebserver.service.impl.LvWangServiceImpl)
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1331)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:622)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:591)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1397)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:968)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:735)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:434)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.UnsupportedClassVersionError: com/ultrapower/hunan/lvwangwebserver/service/impl/LvWangServiceImpl : Unsupported major.minor version 52.0 (unable to load class com.ultrapower.hunan.lvwangwebserver.service.impl.LvWangServiceImpl)
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2858)
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:249)
    at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:395)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1349)
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1320)
    ... 34 more
七月 24, 2017 3:42:30 下午 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
七月 24, 2017 3:42:30 下午 org.apache.catalina.core.StandardContext start
严重: Context [/hunanidcalarm] startup failed due to previous errors
七月 24, 2017 3:42:30 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/hunanidcalarm] appears to have started a thread named [Thread-2] but has failed to stop it. This is very likely to create a memory leak.
七月 24, 2017 3:42:30 下午 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-58181
七月 24, 2017 3:42:30 下午 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:28009
七月 24, 2017 3:42:30 下午 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/86  config=null
七月 24, 2017 3:42:30 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 2109 ms

 

以上是关于Unsupported major.minor version 52.0的主要内容,如果未能解决你的问题,请参考以下文章

Unsupported major.minor version 52.0

Kafka Unsupported major.minor version 52.0

Unsupported major.minor version 52.0

Unsupported major.minor version 52.0

Unsupported major.minor version 51.0解决办法

Unsupported major.minor version 51.0