开发者社区 问答 正文

java 驱动为何加了cj还是出现报错 ?报错

为何加了cj还是出现报错Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class iscom.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException图片说明

展开
收起
爱吃鱼的程序员 2020-06-22 23:58:08 857 分享 版权
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    Class.forName("com.mysql.jdbc.Driver");为什么加一个cj。

    检查是否存在老的jar包,包括你的项目lib和tomcat的lib目录下

    2020-06-22 23:58:26
    赞同 展开评论