Mybatis连接MySQL数据库问题java.lang.NoClassDefFoundError:java/sql/SQLException

本文记录了在使用Mybatis连接MySQL时遇到的java.lang.NoClassDefFoundError:java/sql/SQLException错误,并分享了解决方案。作者在检查Mapper.xml和conf.xml文件未发现问题后,发现是由于使用jdk13版本导致的兼容性问题,最终通过切换到jdk8解决了该问题。

今天学习Mybatis,在连接MySQL数据库时遇到如下问题:java.lang.NoClassDefFoundError:java/sql/SQLException在这里插入图片描述
定位错误代码如下:
在这里插入图片描述
遇到NoClass问题,首先检查Mapper.xml文件和conf.xml文件有没有编写错误。我检查没有发现问题,最终发现是jdk13版本兼容问题,切换到jdk8之后,解决。

Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'JWTAuthenticationFilter': Unsatisfied dependency expressed through field 'service'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysUserDetailsService': Unsatisfied dependency expressed through field 'passwordEncoder'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webSecurityConfig': Unsatisfied dependency expressed through field 'userLogMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userLogMapper' defined in file [D:\workspace\lzwy\baowu\durpProject_SVN\target\classes\com\pde\baowu\etlservice\mapper\UserLogMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'master2SqlSessionFactory' defined in class path resource [com/pde/baowu/etlservice/config/ShardingRuleConfig.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getShardingDataSource' defined in class path resource [com/pde/baowu/etlservice/config/ShardingRuleConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'getShardingDataSource' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/shardingsphere/infra/datasource/pool/props/creator/DataSourcePoolPropertiesCreator
04-23
评论 3
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值