java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at com.baomidou.mybatisplus.generator.config.DataSourceConfig.getConn(DataSourceConfig.java:196) at com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder.handlerDataSource(ConfigBuilder.java:269) at com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder.<init>(ConfigBuilder.java:132) at com.baomidou.mybatisplus.generator.AutoGenerator.execute(AutoGenerator.java:92) at com.qingmu.springboot.common.Generator.MybatisPlusGenerator.main(MybatisPlusGenerator.java:148) Exception in thread "main" java.lang.NullPointerException at com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder.getTablesInfo(ConfigBuilder.java:457) at com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder.handlerStrategy(ConfigBuilder.java:281) at com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder.<init>(ConfigBuilder.java:142) at com.baomidou.mybatisplus.generator.AutoGenerator.execute(AutoGenerator.java:92) at com.qingmu.springboot.common.Generator.MybatisPlusGenerator.main(MybatisPlusGenerator.java:148)
com.mysql.jdbc.Driver 是 mysql-connector-java 5中的
JDBC连接Mysql5 com.mysql.jdbc.Driver:
org.quartz.dataSource.qzDS.driver:com.mysql.jdbc.Driver org.quartz.dataSource.qzDS.URL:jdbc:mysql://localhost:3306/mysql?useUnicode=true&characterEncoding=UTF-8
com.mysql.cj.jdbc.Driver 是 mysql-connector-java 6中的
JDBC连接Mysql6 com.mysql.cj.jdbc.Driver, 需要指定时区serverTimezone:
#org.quartz.dataSource.qzDS.driver:com.mysql.cj.jdbc.Driver #org.quartz.dataSource.qzDS.URL:jdbc:mysql://localhost:3306/mysql?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false
如果你用的mysql-connector-java 5,配置的是com.mysql.cj.jdbc.Driver的配置就会报java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver这个错误。
如果你用的mysql-connector-java 6,配置的是com.mysql.jdbc.Driver的配置也会出现错误,总之MySQL版本要与其配置对应好。
原文地址:https://www.cnblogs.com/qingmuchuanqi48/p/11611849.html
时间: 2024-11-10 07:39:55