Announcement Announcement Module
Collapse
No announcement yet.
Problem with Spring and Struts (NotWritablePropertyException) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with Spring and Struts (NotWritablePropertyException)

    Hi.
    I'm trying to integerate Struts with Spring (by reimplementing PetClinic app).
    Here are the steps :
    1. in applicationContext-hibernate.xml :
    Code:
    <bean name="/actions/allvets" class="com.web.actions.AllVetsAction">
    	<property name="clinic" ref="clinicTarget />
    </bean>
    2. in struts-config.xml:
    Code:
    <action path="/actions/allvets" type="org.springframework.web.struts.DelegatingActionProxy">
    	<forward name="all-vets" path="/WEB-INF/jsp/allvets.jsp"/>
    </action>
    <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
        	<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext-hibernate.xml"/>
     </plug-in>
    3. In AllVetsAction :
    Code:
    private Clinic clinic;
    	
    public Clinic getClinic( ) {
    	return clinic;
    }
    	
    public void setClinic(Clinic clinic) {
    	this.clinic = clinic;
    }
    4. Clinic.java, HibernateClinic.java are just like classes in PetClinic app.
    When trying to run the app, I got the following exception during Tomcat's boot :
    Code:
    org.springframework.beans.NotWritablePropertyException: Invalid property 'clinic' of bean class 
    [com.web.actions.AllVetsAction]: Bean property 'clinic' is not writable or has an invalid setter
    method: Does the parameter type of the setter match the return type of the getter?
    Well, I don't see any problem !
    What about you ?
Working...
X