之前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)哦!怎么会出现这个! 机智的我网上一把搜,原来是这里:
重启,还是不行!
而且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, 于是, 改!
重启, 还是一样的。。
...
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 的, 于是 检查一下, 果然这里有问题
把其中的 jdk 改成1.7 的, 重启tomcat , 没那个错误了!!
posted on 2016-10-11 11:28 阅读( ...) 评论( ...)