当前位置: 代码迷 >> J2EE >> is org.springframework.beans.NotWritablePropertyException:
  详细解决方案

is org.springframework.beans.NotWritablePropertyException:

热度:245   发布时间:2016-04-22 03:10:29.0
spring和struts1.X集成的问题
struts-config.xml内容如下:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts-config PUBLIC
  "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
  "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
<form-beans>
<form-bean name="orgForm" type="com.bjsxt.oa.web.forms.OrgActionForm"></form-bean>
</form-beans>

<action-mappings>
<action path="/org"
type="org.springframework.web.struts.DelegatingActionProxy" name="orgForm"
scope="request" parameter="method">
<forward name="index" path="/org/index.jsp"></forward>
<forward name="add_input" path="/org/add_input.jsp" />
</action>
</action-mappings>
<controller>
<set-property property="processorClass"
value="org.springframework.web.struts.DelegatingRequestProcessor" />
</controller>
<message-resources parameter="MessageResources" />
</struts-config>

applicationContext.xml中配置的bean属性如下:
<bean id="orgManager" class="com.bjsxt.oa.manager.impl.OrgManagerImpl">
<property name="sessionFactory" ref="sessionFactory" />
</bean>

<bean name="/org" class="com.bjsxt.oa.web.actions.OrgAction" scope="prototype">
  <property name="orgManager" ref="orgManager"/>
</bean>

出错提示:org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/org' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'orgManager' of bean class [com.bjsxt.oa.web.actions.OrgAction]: Bean property 'orgManager' 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 'orgManager' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?


orgManager属性没有set/get方法!!
------解决方案--------------------
1楼正解
------解决方案--------------------
探讨
Bean property 'orgManager' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?


orgManager属性没有set/get方法!!

------解决方案--------------------
请注意命名规范 也可能导致找不到该属性的set方法
------解决方案--------------------
在com.bjsxt.oa.web.actions.OrgAction中,添加orgManager成员变量,并给出它的set方法
------解决方案--------------------
orgManager在com.bjsxt.oa.web.actions.OrgAction里面没有set()
  相关解决方案