Java – COM / MySQL / JDBC / Driver: Unsupported major Minor version 52.0

When I was in Apache Tomcat / 7.0 52 (Ubuntu) deploying my war using MySQL connector - java-6.0 3. Jar encountered this problem: 1.7.0 compiled with JDK 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)

When I compiled with 1.8, this

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)

And this one 1.6:

java.lang.Error: Unresolved compilation problem: 
    Multi-catch parameters are not allowed for source level below 1.7

Solution

The problem is not compilation The problem is that you try to use Java 7 to run Tomcat. Net for your deployed application As your MySQL driver, and possibly your application is compiled using java 8, you must use Java 8 to run Tomcat

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>