Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:

线程“main”org.apache.ibatis.exceptions.PersistenceException中的异常:
今天学习mybatis时运行程序报了如题错误,网上有说是没加时区的问题,也有说是驱动问题。我改了改了mybatis的版本,仍旧是同一错误,不是mybatis的问题,之后我把mysql驱动改成之前下载的版本,可以成功运行,但显示如下警告

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

意思是:加载类 'com.mysql.jdbc.Driver'.这已弃用。新的驱动程序类是“com.mysql.cj.jdbc.Driver”。驱动程序通过 SPI 自动注册,通常不需要手动加载驱动程序类。然后我按要求加上cj就不显示警告了。

其中在调试过程中,有这么一条警告:

Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.

我开始以为是数据库的问题,后来发现是驱动的问题,然后我感觉以后遇到这种与server、connection(服务器,不能链接啥啥的)等相关词的,可以先考虑是不是驱动的问题,因为还没有连接成功。

另外在修改pom.xml文件后,记得点一下maven,否则配置不会被更改。