日期:2014-05-17  浏览次数:20599 次

ssh搭建问题,请问这是什么异常,我在学习实在找不出来了
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productAction' defined in URL [file:/D:/program/apache-tomcat-6.0.20/webapps/TestPage/WEB-INF/classes/applicationContext.xml]: Cannot resolve reference to bean 'productService' while setting bean property 'productService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productService' defined in URL [file:/D:/program/apache-tomcat-6.0.20/webapps/TestPage/WEB-INF/classes/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'productDao' of bean class [com.pb.service.impl.ProductServiceImpl]: Bean property 'productDao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

ssh exception bean

------解决方案--------------------
看一下com.pb.service.impl.ProductServiceImpl这个类中有没有productDao这个属性和setter方法。注意属性的名字大小写要一致,setter方法的大小写要和属性一致
------解决方案--------------------
com.pb.service.impl.ProductServiceImpl里面的'productDao' 没有set方法,导致后面创建bean出错
------解决方案--------------------
 Bean property 'productDao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

检查下;

get set 方法最好自动生成,否则很容易出错。