org.springframework.beans.NotWritablePropertyException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • upgrading a functioning 2.5 app to the most recent 3.0 (M4) release. I have the following bean definition that fails in 3.0 M4: <bean id="localeResolver"^M class="org.springframework.web.servlet.i18n.CookieLocaleResolver">^M <property name="cookieName" value="language" />^M <property name="cookieMaxAge" value="3600" />^M <property name="defaultLocale" value="en" />^M </bean> When I deploy this in Tomcat 6.20 I get the following error. SEVERE: Allocate exception for servlet court org.springframework.beans.NotWritablePropertyException: Invalid property 'cookieMaxAge' of bean class [org.springframework.web.servlet.i18n.CookieLocaleResolver]: Bean property 'cookieMaxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:850) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:701) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:60) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1330) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1060) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:449) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:289) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:286) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:188) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:528) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:716) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:383) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:447) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:342) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:308) at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) I reviewed the docs on M4 http://static.springsource.org/spring/docs/3.0.0.M4/javadoc-api/org/springframework/web/servlet/i18n/CookieLocaleResolver.html The method is inherited from org.springframework.web.util.CookieGenerator . I saw the source https://src.springframework.org/svn/spring-framework/tags/spring-framework-3.0.0.M4/org.springframework.web/src/main/java/org/springframework/web/util/CookieGenerator.java And the set and getCookieMaxAge methods appears to be there. Not exactly sure what is the root of this error message/bug.
    via by Daniel Rubio,
  • upgrading a functioning 2.5 app to the most recent 3.0 (M4) release. I have the following bean definition that fails in 3.0 M4: <bean id="localeResolver"^M class="org.springframework.web.servlet.i18n.CookieLocaleResolver">^M <property name="cookieName" value="language" />^M <property name="cookieMaxAge" value="3600" />^M <property name="defaultLocale" value="en" />^M </bean> When I deploy this in Tomcat 6.20 I get the following error. SEVERE: Allocate exception for servlet court org.springframework.beans.NotWritablePropertyException: Invalid property 'cookieMaxAge' of bean class [org.springframework.web.servlet.i18n.CookieLocaleResolver]: Bean property 'cookieMaxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:850) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:701) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:60) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1330) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1060) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:449) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:289) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:286) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:188) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:528) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:716) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:383) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:447) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:342) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:308) at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) I reviewed the docs on M4 http://static.springsource.org/spring/docs/3.0.0.M4/javadoc-api/org/springframework/web/servlet/i18n/CookieLocaleResolver.html The method is inherited from org.springframework.web.util.CookieGenerator . I saw the source https://src.springframework.org/svn/spring-framework/tags/spring-framework-3.0.0.M4/org.springframework.web/src/main/java/org/springframework/web/util/CookieGenerator.java And the set and getCookieMaxAge methods appears to be there. Not exactly sure what is the root of this error message/bug.
    via by Daniel Rubio,
  • Tomcat cannot start
    via Stack Overflow by sone
    ,
  • [Spring+Hibernate]Invalid property
    via by Stas Baturin,
    • org.springframework.beans.NotWritablePropertyException: Invalid property 'cookieMaxAge' of bean class [org.springframework.web.servlet.i18n.CookieLocaleResolver]: Bean property 'cookieMaxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:850) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:701) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:60) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1330) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1060) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:449) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:289) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:286) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:188) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:528) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:716) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:383) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:447) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:342) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:308) at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

    Users with the same issue

    Unknown visitor
    Unknown visitor2 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    25 more bugmates