ssh框架搭建,请问这个异常啥意思,找不出问题
org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'pro...
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?
我的application是这个
<bean id="productAction" class="com.pb.action.Action1">
<property name="productService" ref="productService" />
</bean>
<bean id="productService" class="com.pb.service.impl.ProductServiceImpl">
<property name="productDao" ref="productDao" />
</bean>
<bean id="productDao" class="com.pb.dao.impl.ProductDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml"/>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<aop:config>
<aop:pointcut id="productServiceMethods"
expression="execution(* com.pb.dao.*.*(..))"/>
<aop:advisor advice-ref="txAdvice"
pointcut-ref="productServiceMethods"/>
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="*" propagation="SUPPORTS" read-only="true"/>
</tx:attributes>
</tx:advice> 展开
我的application是这个
<bean id="productAction" class="com.pb.action.Action1">
<property name="productService" ref="productService" />
</bean>
<bean id="productService" class="com.pb.service.impl.ProductServiceImpl">
<property name="productDao" ref="productDao" />
</bean>
<bean id="productDao" class="com.pb.dao.impl.ProductDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml"/>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<aop:config>
<aop:pointcut id="productServiceMethods"
expression="execution(* com.pb.dao.*.*(..))"/>
<aop:advisor advice-ref="txAdvice"
pointcut-ref="productServiceMethods"/>
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="*" propagation="SUPPORTS" read-only="true"/>
</tx:attributes>
</tx:advice> 展开
展开全部
估计是你的productDao除了问题,看看你的ProductService里用的是不是接口:ProductDao,不要在ProductService里用ProductDaoImpl
关键的问题是在这里:
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?
关键的问题是在这里:
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?
追问
不好意思我没太看明白你说的意思。我的service确实是注入了dao啊。而且dao也没啥问题啊。
大雅新科技有限公司
2024-11-19 广告
2024-11-19 广告
这方面更多更全面的信息其实可以找下大雅新。深圳市大雅新科技有限公司从事KVM延长器,DVI延长器,USB延长器,键盘鼠标延长器,双绞线视频传输器,VGA视频双绞线传输器,VGA延长器,VGA视频延长器,DVI KVM 切换器等,优质供应商,...
点击进入详情页
本回答由大雅新科技有限公司提供
展开全部
productAction 中没有productService 的set方法。 (4A电影网的搭建框架就是SSI。你可以看下)
追问
Product product;
ProductService ps;
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
public ProductService getPs() {
return ps;
}
public void setPs(ProductService ps) {
this.ps = ps;
}
有这个方法呀
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询