Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to instantiate default tuplizer [

2010-11-30 15:47:28,328 ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'YonghushuxingAction' defined in ServletContext resource
[/WEB-INF/context/applicationContext-action.xml]: Cannot resolve reference to bean 'YonghushuxingService'
while setting bean property 'yonghushuxingService';
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'YonghushuxingService' defined in ServletContext resource
 [/WEB-INF/context/applicationContext-service.xml]:
 Cannot resolve reference to bean 'YonghushuxingDAO'
  while setting bean property 'yonghushuxingDAO';
  nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'YonghushuxingDAO' defined in ServletContext resource
[/WEB-INF/context/applicationContext-dao.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/context/applicationContext-hibernate.xml]:
Invocation of init method failed; nested exception is org.hibernate.HibernateException:
Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]

我在部署好项目之后,出现了如此多的错误,百度,谷歌了一下,没有找到具体的解决办法,于是只能自己解决了。

在控制台里,上面错误的后边还有好多错误,我找到了最后的一条。

 

Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for flag  in class cn.com.hanker.fengdian.model.Yonghushuxing
 at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:306)
 at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:299)
 at org.hibernate.mapping.Property.getGetter(Property.java:294)
 at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:300)
 at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:141)
 at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:78)
 ... 87 more

 

看一下字体放大的部分,我就从配置文件里找到了 flag这个属性,

原来在Hibernate的映射配置文件里,我的flag后面有空格,这样的属性配置和数据库里的属性不相符,于是我改过来了。

再次运行,终于成功了。

通过以上错误我觉得应该更认真点,属性名和数据库里面的字段名,最好是粘贴复制的,这样才不容易出错。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值