当我在Apache Tomcat / 7.0.52(Ubuntu)JVM上部署我的战争USING
mysql-connector-
java-6.0.3.jar时遇到此问题:使用JDK 1.7编译的1.7.0_79-b14
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
解决方法
问题不在于编译.问题是您尝试使用java 7运行已部署应用程序的Tomcat.作为您的MysqL驱动程序,并且可能,您的应用程序是使用java 8编译的,您必须使用java 8来运行Tomcat