java.lang.UnsupportedClassVersionError: org/laywer/wechat/servlet/Wechatservlet : Unsupported major.minor version 52.0 (unable to load class org.laywer.wechat.servlet.Wechatservlet)
jdk编译版本与出现问题的项目JDK编译版本不一致所导致,报错如下:
java.lang.UnsupportedClassVersionError: org/laywer/wechat/servlet/Wechatservlet : Unsupported major.minor version 52.0 (unable to load class org.laywer.wechat.servlet.Wechatservlet)
org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2498)
org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:860)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1302)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:748)
解决方案
假设开发是jdk1.8,服务器环境是1.7:
1、进入 windows---proferences---java--compiler设置编译出来的文件使用的格式是 1.7版本的 |
2、进入项目--properties---java Compiler 把项目编译版本也设置成 1.7 |
3、进入项目--properties---Myeclipse---project Facets设置java文件的版本为 1.7 |