Spring 2.5 to 3.2 upgrade error: Invalid property 'commandClass' of bean class -


i new spring , upgrading spring 2.5 web app 3.2.3. getting error navigating off front page of app. error invalid property 'commandclass' of bean class. web app has been running 5 years, issue has spring 2.5 3.2 changes. must have wired wrong, ideas?

the full error :

    error creating bean name '/new_candidate.html' defined in servletcontext resource [/web-inf/webapp-servlet.xml]: 

error setting property values; nested exception org.springframework.beans.notwritablepropertyexception: invalid property 'commandclass' of bean class [org.myorg.app.web.scorechangecontroller]: bean property 'commandclass' not writable or has invalid setter method. parameter type of setter match return type of getter?

here bean def webapp-sevlet.xml:

<bean name="/new_candidate.html" class="org.myorg.app.web.scorechangecontroller" scope="session">     <property name="commandclass" value="org.myorg.app.model.database"/>     <property name="formview" value="generic"/>     <property name="candidatemanager" ref="candidatemanager"/> </bean> 

the controller is:

package org.myorg.app.web;  import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse;  import org.myorg.app.model.database; import org.myorg.app.service.candidatemanager;  import org.springframework.web.servlet.modelandview;  import org.springframework.web.servlet.view.redirectview; import org.springframework.web.bind.servletrequestdatabinder; import org.springframework.validation.bindexception; import org.springframework.web.util.webutils; import org.springframework.stereotype.controller; import org.springframework.web.bind.annotation.requestmapping;   public class scorechangecontroller   {  private candidatemanager candidatemanager;   protected object formbackingobject(httpservletrequest request) throws exception {      database defaultdatabase = new database();     defaultdatabase.setapptno("16 digits");     defaultdatabase.setaccessionno("8 digits");     defaultdatabase.settstpkgid("12345678912345678912345");     return defaultdatabase; }    protected void initbinder(httpservletrequest request, servletrequestdatabinder binder) throws exception {         database database = (database)binder.gettarget();     }  public candidatemanager getcandidatemanager() {     return candidatemanager; }  public void setcandidatemanager(candidatemanager candidatemanager) {     this.candidatemanager = candidatemanager; }  public modelandview onsubmit(httpservletrequest req, httpservletresponse res, object command, bindexception errors) throws exception {      if(webutils.hassubmitparameter(req, "retrieve"))     {         candidatemanager.retrievedata((database)command);      }     return new modelandview(new redirectview("success.jsp"));  }  } 

you trying inject property commandclass inside scorechangecontroller bean, not able see property name in controller , not subclass of specific controller no chance of inheritance also.

solution : either remove injection of commandclassproperty scorechangecontroller bean .

<bean name="/new_candidate.html" class="org.myorg.app.web.scorechangecontroller" scope="session"> <property name="formview" value="generic"/> <property name="candidatemanager" ref="candidatemanager"/> 

or create new property in scorechangecontroller having name command , create setters , getters that.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -