首页 新闻 会员 周边 捐助

用maven,spring集成hibernate ,struts2 报错sessionFactory有问题!!!!

0
悬赏园豆:10 [待解决问题]

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\workspace\erp_parent\erp_web\target\classes\applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.PropertyNotFoundException: Could not locate getter method for property [com.heima.domain.Dep#id]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
    ... 24 more
Caused by: org.hibernate.PropertyNotFoundException: Could not locate getter method for property [com.heima.domain.Dep#id]
    at org.hibernate.internal.util.ReflectHelper.findGetterMethod(ReflectHelper.java:400)
    at org.hibernate.property.access.internal.PropertyAccessBasicImpl.<init>(PropertyAccessBasicImpl.java:41)
    at org.hibernate.property.access.internal.PropertyAccessStrategyBasicImpl.buildPropertyAccess(PropertyAccessStrategyBasicImpl.java:27)
    at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:322)
    at org.hibernate.tuple.PropertyFactory.buildIdentifierAttribute(PropertyFactory.java:63)
    at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:141)
    at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:509)
    at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:124)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:96)
    at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:77)
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:346)
    at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)
    at org.springframework.orm.hibernate5.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:416)
    at org.springframework.orm.hibernate5.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:401)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
    ... 31 more

张三哟的主页 张三哟 | 初学一级 | 园豆:192
提问于:2017-09-12 02:18
< >
分享
所有回答(2)
0

com.heima.domain.Dep#id 这个model对象有问题吧,其id的getter定义了吗?

2012 | 园豆:21645 (高人七级) | 2017-09-12 08:22

感谢,就是的,我把id改了一次,忘记改getter方法了

支持(0) 反对(0) 张三哟 | 园豆:192 (初学一级) | 2017-09-12 10:58
0

楼上说的很对,Dep对象id的getter方法看看定义了没。

随风奔跑的狼 | 园豆:202 (菜鸟二级) | 2017-09-12 10:48

嗯啊,
找到了,谢了

支持(0) 反对(0) 张三哟 | 园豆:192 (初学一级) | 2017-09-12 10:59

@张三哟: 你可以看到异常日志里面有具体说明,新手要多看异常日志,才能从根上解决问题。

支持(0) 反对(0) 随风奔跑的狼 | 园豆:202 (菜鸟二级) | 2017-09-12 11:34

@随风奔跑的狼: 嗯啊
,好的。

支持(0) 反对(0) 张三哟 | 园豆:192 (初学一级) | 2017-09-12 11:54
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册