【⭐】Java—Spring-—数据库操作—使用内置连接池,报读取不到驱动错误。Could not load JDBC driver class。...
生活随笔
收集整理的這篇文章主要介紹了
【⭐】Java—Spring-—数据库操作—使用内置连接池,报读取不到驱动错误。Could not load JDBC driver class。...
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
? ? 項目功能:
連接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包!!
?
? 所以報的是無法找到驅動。
?
轉載于:https://www.cnblogs.com/PinkManBlog/p/11027787.html
總結
以上是生活随笔為你收集整理的【⭐】Java—Spring-—数据库操作—使用内置连接池,报读取不到驱动错误。Could not load JDBC driver class。...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 农行现金10万能直接取吗
- 下一篇: Oracle索引知识学习笔记