博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
记一次jdk升级引起的 Unsupported major.minor version 51.0
阅读量:5059 次
发布时间:2019-06-12

本文共 6959 字,大约阅读时间需要 23 分钟。

之前jdk 一直是1.6,tomcat 是6.x 版本,, 现在引入的新的jar, 出现

Caused by: java.lang.UnsupportedClassVersionError: org/apache/lucene/search/TopDocs : Unsupported major.minor version 51.0 (unable to load class org.apache.lucene.search.TopDocs)

at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2779)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1126)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1614)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1493)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:460)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:443)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:363)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:296)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:745)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:448)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:283)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
... 30 more

难道是lucene 版本过高吗? 51 表示的是jdk7, 于是乎升级jdk 吧! 呼呼呼从1.6 升级到 1.7, 可是还有。。。

java.lang.reflect.InvocationTargetException

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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: net/jweb/listener/AppInitializerListener : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.zeroturnaround.javarebel.yy.defineRebelClass(JRebel:180)
at com.zeroturnaround.javarebel.Cr.a(JRebel:660)
at com.zeroturnaround.javarebel.yA.a(JRebel:263)
at com.zeroturnaround.javarebel.ym.a(JRebel:182)
at com.zeroturnaround.javarebel.yA.loadReloadableClass(JRebel:324)
at com.zeroturnaround.javarebel.SDKIntegrationImpl.findReloadableClass(JRebel:85)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1614)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1493)
at org.apache.catalina.startup.WebAnnotationSet.loadClassAnnotation(WebAnnotationSet.java:145)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:73)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:56)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:297)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1078)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4578)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
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:701)
at org.apache.catalina.startup.Catalina.start(Catalina.java:585)
... 6 more

检查一下errors 面板:

Description Resource Path Location Type
Java compiler level does not match the version of the installed Java project facet. lkStoreServer Unknown Faceted Project Problem (Java Version Mismatch)

哦!怎么会出现这个! 机智的我网上一把搜,原来是这里:

493842-20161011112600227-1033056092.png

重启,还是不行!

而且errors 面板还是各种错误:

Description Resource Path Location Type
Access restriction: The constructor BASE64Decoder() is not accessible due to restriction on required library E:\Java\jdk1.7.0\jre\lib\rt.jar DESUtil.java /lkStoreServer/src/java/net/jweb/common/util line 74 Java Problem
...

突然想到, java web 项目的依赖jdk 改成了1.7, 但是 编译的level 还是 1.6, 于是, 改!

493842-20161011111941743-588470175.png

重启, 还是一样的。。

...

Caused by: java.lang.UnsupportedClassVersionError: net/jweb/listener/AppInitializerListener : Unsupported major.minor version 51.0
...

郁闷, 我老油条了, 还会遇到这样的问题啊! 网上搜索下 , 在stackoverflow 看到,

This is because of a higher JDK during compile time and lower JDK during runtime. So you just need to update your JDK version, possible to JDK 7

这个道理已经很明了了, 而且很容易理解 , 我的运行时 jdk 版本低于编译时版本51, 也就是1.7, 想到自己本地安装了好几个版本的jdk , 又想到tomcat 运行也是依赖jdk 的, 于是 检查一下, 果然这里有问题

493842-20161011112332149-1364641535.png

把其中的 jdk 改成1.7 的, 重启tomcat , 没那个错误了!!

posted on
2016-10-11 11:28 阅读(
...) 评论(
...)

转载于:https://www.cnblogs.com/FlyAway2013/p/5948608.html

你可能感兴趣的文章
Hadoop流程---从tpch到hive
查看>>
数据结构3——浅谈zkw线段树
查看>>
Introduction to my galaxy engine 2: Depth of field
查看>>
V2019 Super DSP3 Odometer Correction Vehicle List
查看>>
Python 3.X 练习集100题 05
查看>>
今时不同往日:VS2010十大绝技让VS6叹服
查看>>
设计器 和后台代码的转换 快捷键
查看>>
在线视频播放软件
查看>>
用代码生成器生成的DAL数据访问操作类 基本满足需求了
查看>>
28初识线程
查看>>
Monkey测试结果分析
查看>>
Sublime Text 3 设置
查看>>
浅谈C++底层机制
查看>>
STL——配接器、常用算法使用
查看>>
第9课 uart
查看>>
Range和xrange的区别
查看>>
BZOJ 1010 [HNOI2008]玩具装箱 (斜率优化DP)
查看>>
java-动态规划算法学习笔记
查看>>
STL容器之vector
查看>>
Linux 内核中断内幕
查看>>