spring mvc 启动报错,求解决

滴滴丶哔哔 发布于 2013/05/31 17:21
阅读 18K+
收藏 0

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public com.mvc.service.StudentServiceInterface com.mvc.controller.StudentController.studentService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mvc.dao.EntityDao com.mvc.service.StudentService.entityDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityDao' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/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 ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.getAnnotation(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/Class;)Ljava/lang/annotation/Annotation;


这个报错信息里面的那个方法没有,但是我用反编译工具看了,那个方法又是有的。

加载中
0
k
kakaximu

未能正常产生数据库连接对象,引起的一系列注入错误。

有可能是配置数据库连接错误,也有可能是包冲突了

0
稻草鸟人
稻草鸟人
studentController  这个Bean注入的可能有问题,自己检查下
0
cxshun
cxshun
dataSource这个注入有问题了,检查一下。
0
Ryan-瑞恩
Ryan-瑞恩
配置文件再重新检查一次!从错误信息来推断是注入Bean时候的问题。配置文件再检查检查大小写那些!等等。
0
skyline520
skyline520
sessionFactory  看看你这个有没有定义,应该这个注入失败,引起 dao -> service->controller 一系列的报错提示
0
唐代de豆腐
唐代de豆腐
studentController 中没有 注入 StudentServiceInterface  
0
今夜吴眠

dataSource   是否没有在 [/WEB-INF/applicationContext.xml] 里写对?

检查一下这个配置文件

0
滴滴丶哔哔
滴滴丶哔哔
<bean id="dataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="${dataSource.driverClassName}" />
		<property name="url" value="${dataSource.url}" />
		<property name="username" value="${dataSource.username}" />
		<property name="password" value="${dataSource.password}" />
	</bean>
dataSource.password=  
dataSource.username=root   
dataSource.databaseName=test   
dataSource.driverClassName=com.mysql.jdbc.Driver   
dataSource.dialect=org.hibernate.dialect.MySQLDialect 
dataSource.serverName=localhost\:3306  
dataSource.url=jdbc\:mysql\://localhost\:3306/test   
dataSource.properties=user\=${dataSource.username};databaseName\=${dataSource.databaseName};serverName\=${dataSource.serverName};password\=${dataSource.password}   
dataSource.hbm2ddl.auto=update  
这是配置文件
返回顶部
顶部