今天spring报错呀,请看以下报错,org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'orderDetailsService' defined in ServletContext resource [/WEB-INF/applicationContext_service.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'orderDAO' of bean class [wteam.service.ordManageService.OrderDetailsService]: Bean property 'orderDAO' 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.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
这是我的xml文件的配置:
<bean name="orderDAO" class="wteam.dao.ordManageDAO.OrderDAO">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean name="orderDetailsDAO" class="wteam.dao.ordManageDAO.OrderDetailsDAO">
<property name="sessionFactory" ref="sessionFactory"/>
</bean><bean name="orderDetailsService" class="wteam.service.ordManageService.OrderDetailsService">
<property name="orderDetailsDAO" ref="orderDetailsDAO"/>
<property name="orderDAO" ref="orderDAO"/>
</bean>
java代码那部分:private OrderDAOItf orderDAO;public OrderDAOItf getorderDAO() {
return orderDAO;
} public void setOrderDAO(OrderDAOItf orderDAO) {
this.orderDAO = orderDAO;
}感觉我的set和get没问题呀,大家能看出哪里有问题吗SpringJava
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
这是我的xml文件的配置:
<bean name="orderDAO" class="wteam.dao.ordManageDAO.OrderDAO">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean name="orderDetailsDAO" class="wteam.dao.ordManageDAO.OrderDetailsDAO">
<property name="sessionFactory" ref="sessionFactory"/>
</bean><bean name="orderDetailsService" class="wteam.service.ordManageService.OrderDetailsService">
<property name="orderDetailsDAO" ref="orderDetailsDAO"/>
<property name="orderDAO" ref="orderDAO"/>
</bean>
java代码那部分:private OrderDAOItf orderDAO;public OrderDAOItf getorderDAO() {
return orderDAO;
} public void setOrderDAO(OrderDAOItf orderDAO) {
this.orderDAO = orderDAO;
}感觉我的set和get没问题呀,大家能看出哪里有问题吗SpringJava
解决方案 »
- JSF,richface中日历空间显示问题
- struts2 urlrewrite 配置无效求问...
- 有J2EE方面的高手想做兼职的吗
- 从ftp服务器上获取文件到服务器,再将服务器上的文件下载到本地目录。。
- 想把spring当做一个工程导入到eclipse里学习源码,怎么弄呢?
- 请教一个关于用Spring+Hibernate的数组问题。
- 急!急!急!Oracle CLOB 读取出错!
- ??????//高手进
- dynaValidatorForm验证
- 请各位兄弟都来看看,快过年了,交流交流经验,想想Struts+hibernate:)
- 服务器端使用JDK1.6自带JAX-WS作成,客户端如何在JDK1.5下编译
- jeecms做的网站,怎样用国际化实现中英文切换啊???求大神
不好意思,有个方法粘贴错:getorderDAO(),应该是:getOrderDAO()的,还是会报错的,
OrderDAOItf 这个类型。。Itf是打错了么?
没错呀,这是个dao的接口,为什么你会认为会可能是打错了呢,大神求解
OrderDAO和OrderDAOItf 不一样吧?
应该是不规范导致的吧,,我没有写过DAO全部大写
这是因为OrderDAO实现接口OrderDAOItf ,然后我service类那里写接口是没错的吧
这是因为OrderDAO实现接口OrderDAOItf ,然后我service类那里写接口是没错的吧
对,你这样用没问题。。
要不你属性orderDAO换个名字,都小写,然后自动生成getter和setter,在重新部署下工程试试?
private OrderDAOItf orderDAO;public OrderDAOItf getorderDAO() {
return orderDAO;
}public void setOrderDAO(OrderDAOItf orderDAO) {
this.orderDAO = orderDAO;
}<bean name="orderDetailsService" class="wteam.service.ordManageService.OrderDetailsService">
<property name="orderDetailsDAO" ref="orderDetailsDAO"/>
<property name="orderDAO" ref="orderDAO"/>
</bean>你bean里这样定义,他默认会去找setOrderDAO和getOrderDAO找不到,就说你没有为这个属性提供set和get方法了。