首页 > 其他分享 >Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException: 解决办法

Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException: 解决办法

时间:2023-03-04 17:36:11浏览次数:28  
标签:Exception jdbc thread PersistenceException mysql exceptions main com

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,否则配置不会被更改。

标签:Exception,jdbc,thread,PersistenceException,mysql,exceptions,main,com
From: https://www.cnblogs.com/he-cheng/p/17178664.html

相关文章

  • 【译】clang ThreadSafetyAnalysis 线程安全分析
    每天晚上临睡前一到两小时,前后花了一两周来试着翻译。过程是痛苦的,却是一个检视自己的好办法。放在git上,正在考虑以后把随笔迁到gitio上。目录clang3.5线程安全分析名词......
  • MySQL参数优化之thread_cache_size
    1.thread_cache_size简介每建立一个连接,都需要一个线程来与之匹配,此参数用来缓存空闲的线程,以至不被销毁,如果线程缓存中有空闲线程,这时候如果建立新连接,MYSQL就会很快的响应......
  • android studio 打包发布 Cause: failed to decrypt safe contents entry: javax.cryp
    androidstudio打包发布错误:Cause:failedtodecryptsafecontentsentry:javax.crypto.BadPaddingException:Givenfinalblocknotproperlypadded.Suchissues......
  • 跨服务传递ThreadLocal解决方案
    通常情况下,我们会将登录用户的相关信息,存放到threadLocal当中,以便于我们在代码中获取用户信息,但是threadLocal的数据只存在于当前请求线程中,对于分布式微服务场景,如......
  • Qt关于moveToThread
    描述:问题最近使用moveToThread函数时遇到一个bug,主线程中创建一个类对象,一个新线程,并把类对象移到新线程中,采用的是新建此类,在建线程,接着线程启动。此时会遇到一个问题......
  • Stackable 是 Threaded 的一个别称,直到 pthreads v.2.0.0
    /***StackableisanaliasofThreaded.Thisclassnamewasusedinpthreadsuntil*version2.0.0*@link​​​http://www.php.net/manual/en/class.threaded......
  • Status Code: BadRequestMicrosoft.Graph.ServiceException: Code: Request_Unsupport
    stringfilter="endsWith(mail,'abc.com')";StatusCode:BadRequestMicrosoft.Graph.ServiceException:Code:Request_UnsupportedQueryMessage:UnsupportedQuery.......
  • ThreadLocal 详解
    ThreadLocal概述ThreadLocal类用来提供线程内部的局部变量,不同的线程之间不会相互干扰这种变量在多线程环境下访问(通过get和set方法访问)时能保证各个线程的变量相对独立......
  • 【SpringCloud】feign.codec.EncodeException: No qualifying bean of type
    错误描述在SpringCloud项目中通过OpenFeign远程调用时出现如下错误:feign.codec.EncodeException:Noqualifyingbeanoftype'org.springframework.boot.autocon......
  • MySQL参数优化之thread_cache_size
    1.thread_cache_size简介每建立一个连接,都需要一个线程来与之匹配,此参数用来缓存空闲的线程,以至不被销毁,如果线程缓存中有空闲线程,这时候如果建立新连接,MYSQL就会很快的响应......