连接mysql数据库,向数据库插入一条数据
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
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)重新导包————————————————解决错误,成功连接数据库,插入数据。
缺少mysql-connector-java-5.1.13-bin.jar包!!
所以报的是无法找到驱动。
如对本文有疑问, 点击进行留言回复!!
解决idea中出现“illegal character U+200B” 问题
荐 为什么加了@Transactional注解,事务没有回滚?
Attribute ‘sklearn.linear_model._logistic.LogisticRegression.multi_class‘ must be explicitly set to
Java/Python实现 LeetCode剑指Offer 14-I.剪绳子(动态规划)
网友评论