java.lang.UnsupportedClassVersionError: com/mysql/cj/jdbc/Driver : Unsupported major.minor version 52.0 (unable to load class [com.mysql.cj.jdbc.Driver])

时间:2024-12-07 16:34:44

原因:
com/mysql/cj/jdbc/Driver是6.0版本的驱动,兼容JDK8环境,不兼容JDK7环境,在基于jdk7的tomcat中编译运行会出错,在基于jdk8的tomcat中编译运行则不会出错。

解决方案:
1、jdk7+老版5.0驱动com/mysql/jdbc/Driver
2、jdk8+新版6.0驱动com/mysql/cj/jdbc/Driver