项目功能:连接MySql数据库,向数据库插入一条数据 项目结构: DEBUG信息:DEBUG [main] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@67b92f0a: ...
项目功能:
连接MySql数据库,向数据库插入一条数据
项目结构:
DEBUG信息:
DEBUG [main] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@67b92f0a: defining beans
[org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,studentService,studentDao,dataSource]; root of factory hierarchy
juint信息:
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'studentService' defined in class path resource [applicationContext.xml]:
Cannot resolve reference to bean 'studentDao' while setting bean property 'studentDao';
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'studentDao' defined in class path resource [applicationContext.xml]:
Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource';
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]:
Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException;
nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException:
Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [${jdbc.driverClass]
分析:
1.配置文件出错。
(1)检测jdbc.properties————————————没有错误
(2)检测applicationContext.xml————————没有错误
2.JAR包错误
(1)重新导包————————————————解决错误,成功连接数据库,插入数据。
问题原因:
产生错误时使用的Jar包: 重新导入的Jar包:


缺少mysql-connector-java-5.1.13-bin.jar包!!
所以报的是无法找到驱动。
编程基础网
本文标题为:【⭐】Java—Spring-—数据库操作—使用内置连接池,报读取不到驱动错误。Could not load JDBC driver class。
基础教程推荐
猜你喜欢
- SpringBoot如何使用Undertow做服务器 2023-02-19
- 如何在我的java代码中检索mysql数据库中的sha1哈希值 2023-10-30
- Java文件管理操作的知识点整理 2023-05-19
- SpringCloud Feign远程调用实现详解 2023-07-01
- Mybatis超详细讲解构建SQL方法 2023-02-18
- Java + Selenium + OpenCV解决自动化测试中的滑块验证问题 2023-03-10
- Java随机数 2023-10-08
- Java如何提供给第三方使用接口方法详解 2022-09-03
- java使用枚举封装错误码及错误信息详解 2023-08-08
- jsp输出当前时间的实现代码 2023-08-02

