当我使用mysql-connector-java-6.0.3.jar部署我的war文件到Apache Tomcat/7.0.52 (Ubuntu) JVM: 1.7.0_79-b14上时,我遇到了这个问题,它是用JDK 1.7编译的。
java.lang.UnsupportedClassVersionError: com/mysql/jdbc/Driver : Unsupported major.minor version 52.0 (unable to load class com.mysql.jdbc.Driver)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2948)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1208)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:191)
com.tdk.callbacks.CallBacksListener.doGet(CallBacksListener.java:45)
javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
当我使用1.8编译时,会出现以下情况:
java.lang.UnsupportedClassVersionError: com/tdk/callbacks/CallBacksListener : Unsupported major.minor version 52.0 (unable to load class com.tdk.callbacks.CallBacksListener)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2948)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1208)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:745)
还有这一个1.6版本:
java.lang.Error: Unresolved compilation problem:
Multi-catch parameters are not allowed for source level below 1.7