org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao'问题

昨天通过Spring+springmvc+hibernate搭一个简易的页面,遇到如下问题:

org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'userDao': Injection of resource dependencies failed;
nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'sessionFactory' defined in class path resource
[beans.xml]: Invocation of init method failed; nested exception is
org.hibernate.MappingException: Could not instantiate id generator
[entity-name=bigdata.model.User]

整整用了一个晚上加一个上午才解决。其实也真正是一个小问题罢了。由错误信息知道在bean.xml文件中无法正确加载sessionFactory这个bean,则有两种可能:

1.bean.xml中没加载到映射文件。

解决方法:在sessionFactory中加入



	
		bigdata/model/User.hbm.xml
	

2.映射文件User.hbm.xml形式有误,所以无法正确加载。

解决办法:我的User.hbm.xml文件




	
		
			
		
		
			
		
		
			
		
	

大概用以上办法能解决相关问题,希望遇到对遇到这种问题的同学有所帮助。

你可能感兴趣的:(Web)