Spring中查询Java对象出错

来源:百度知道 编辑:UC知道 时间:2024/06/23 12:52:08
log4j:WARN No appenders could be found for logger (org.springframework.core.CollectionFactory).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'litQuery' defined in class path resource [cn/edu/scnu/spring/dao/litInformationDao/beans.xml]: Cannot resolve reference to bean 'litQueryById' while setting bean property 'litQueryById'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'litQueryById' defined in class path resource [cn/edu/scnu/spring/dao/litInformationDao/beans.xml]: Cannot resolve reference to bean 'dataSource' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [cn/edu/scnu/spring/dao/litInformation

最主要的是这一句
nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver]

你没有放入mysql的jar包,去网上搜索 下一个,然后添加到classpath,就行了

如果是用myEclipse 就放到你WEB-INF的lib下面