s2sh框架中spring注入错误-no getter
来源:互联网 发布:扬州市软件行业协会 编辑:程序博客网 时间:2024/06/02 04:25
错误的信息如下:
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataShareServiceImpl' defined in file [C:/Documents and Settings/Administrator/workspace/.metadata/.plugins/com.genuitec.eclipse.easie.tomcat.myeclipse/tomcat/webapps/GeoGlobeAdmin/WEB-INF/classes/spring/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'hibernateTemplate' of bean class [com.geoglobeportal.appservice.service.impl.DataShareService]: Bean property 'hibernateTemplate' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'hibernateTemplate' of bean class [com.geoglobeportal.appservice.service.impl.DataShareService]: Bean property 'hibernateTemplate' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:793)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:648)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1127)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:423)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
解决此类问题的关键在于找到关键的错误语句,这次关键的错误语句是:
Bean property 'hibernateTemplate' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
在这个错误中我们可以发现'hibernateTemplate'没有getter,是什么原因造成没有getter的呢?
hibernateTemplate'是依赖于sessionFactory的
其实前面的 Error creating bean with name 'dataShareServiceImpl' defined in file中我们可以发现dataShareServiceImpl是错误的来源,说白了就是'dataShareServiceImpl'中没有setSessionFactory()
解决方法:
可以让 'dataShareServiceImpl' extends JdbcDaoSupport
或者 'dataShareServiceImpl' extends HibernateDaoSupport
在以上两个继承类中都实现了getter和setter方法
- s2sh框架中spring注入错误-no getter
- 框架技术--S2SH框架整合(spring部分)No 2--属性注入
- 框架技术--S2SH框架整合(spring部分)No 1
- 框架技术--S2SH框架整合(spring部分)No 3--声明式事务
- Mybatis匹配Mapper报no getter错误
- 【j2ee spring】20、S2SH框架中,把struts2的action交给Spring管理有什么好处?
- Spring S2SH框架整合(一)
- Strust2+Spring+Hibernate(S2SH)框架搭建
- 在spring+hibernate框架的java项目开发过程中,经常会遇到这样的错误: could not find a getter for ... in class ...
- 框架技术--S2SH框架整合(hibernate部分) No 1
- 框架技术--S2SH框架整合(异常)No 1
- 框架技术--S2SH框架整合(注解 No 1)
- Spring框架中属性的注入
- S2SH错误
- S2SH中java.lang.NoSuchMethodError错误分析
- mybatis中出现There is no getter for property named 'depIds' in 'class java.lang.String'的错误
- Struts程序中的No getter method for property错误问题
- Spring 框架依赖注入
- python 2.4与2.5中字符串与datetime转换的区别
- 滚动条更新注意
- vs2008 出現“An error occurred loading this property page”解決方法
- 为Asterisk增加中文语音合成TTS功能-eSpeak应用(转)
- mssql行锁
- s2sh框架中spring注入错误-no getter
- Liunx Fork Exec Processes
- seo的9个技巧总结
- 五招把“拖延症”拒之门外
- HttpModule的认识
- testurl
- Please manually configure the Domino Server as follows
- Window.ShowModalDialog使用手册
- DataSourceTestCase 使用多个数据源