org.springframework.beans.NotReadablePropertyException: Invalid property '_email' of bean class [org.ramanandi.matri.domain.model.User]: Bean property '_email' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?

Spring JIRA | Sudhir nimavat | 7 years ago
  1. 0

    {code} @Entity public class User extends BaseEntity { @NotEmpty @Basic private String _email; //No java bean style getter setter public String getEmail() { return _email; } public void setEmail(String email) { _email = email; } } {code} The above code will cause the spring to through error {code}Invalid property '_email' of bean class [org.ramanandi.matri.domain.model.User]: Bean property '_email' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? Caused by: org.springframework.beans.NotReadablePropertyException: Invalid property '_email' of bean class [org.ramanandi.matri.domain.model.User]: Bean property '_email' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:674) at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:666) at org.springframework.validation.AbstractPropertyBindingResult.getActualFieldValue(AbstractPropertyBindingResult.java:96) at org.springframework.validation.AbstractBindingResult.rejectValue(AbstractBindingResult.java:103) at org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:79) at org.springframework.validation.DataBinder.validate(DataBinder.java:692) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doBind(HandlerMethodInvoker.java:797) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:349) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:169) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:421) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:409) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) ................ ............... {code} As per the specification, Field level constraint should not need java bean style getters/setters and should be accessed using field access strategy See http://docs.jboss.org/hibernate/stable/validator/reference/en/html/validator-usingvalidator.html#d0e265 {quote} When using field level constraints field access strategy is used to access the value to be validated. This means the instance variable directly independed of the access type. {quote} However spring forces me to have a pair of getter/setter.

    Spring JIRA | 7 years ago | Sudhir nimavat
    org.springframework.beans.NotReadablePropertyException: Invalid property '_email' of bean class [org.ramanandi.matri.domain.model.User]: Bean property '_email' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
  2. 0

    {code} @Entity public class User extends BaseEntity { @NotEmpty @Basic private String _email; //No java bean style getter setter public String getEmail() { return _email; } public void setEmail(String email) { _email = email; } } {code} The above code will cause the spring to through error {code}Invalid property '_email' of bean class [org.ramanandi.matri.domain.model.User]: Bean property '_email' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? Caused by: org.springframework.beans.NotReadablePropertyException: Invalid property '_email' of bean class [org.ramanandi.matri.domain.model.User]: Bean property '_email' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:674) at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:666) at org.springframework.validation.AbstractPropertyBindingResult.getActualFieldValue(AbstractPropertyBindingResult.java:96) at org.springframework.validation.AbstractBindingResult.rejectValue(AbstractBindingResult.java:103) at org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:79) at org.springframework.validation.DataBinder.validate(DataBinder.java:692) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doBind(HandlerMethodInvoker.java:797) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:349) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:169) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:421) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:409) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) ................ ............... {code} As per the specification, Field level constraint should not need java bean style getters/setters and should be accessed using field access strategy See http://docs.jboss.org/hibernate/stable/validator/reference/en/html/validator-usingvalidator.html#d0e265 {quote} When using field level constraints field access strategy is used to access the value to be validated. This means the instance variable directly independed of the access type. {quote} However spring forces me to have a pair of getter/setter.

    Spring JIRA | 7 years ago | Sudhir nimavat
    org.springframework.beans.NotReadablePropertyException: Invalid property '_email' of bean class [org.ramanandi.matri.domain.model.User]: Bean property '_email' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
  3. 0

    acess to userName from jsp using spring security

    Stack Overflow | 3 years ago | user2645679
    org.springframework.beans.NotReadablePropertyException: Invalid property 'principal.username' of bean class [org.springframework.security.authentication.UsernamePasswordAuthenticationToken]: Bean property 'principal.username' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    I Keep getting 'NotReadablePropertyException' when running a unit test against a new Spring Validator class

    Stack Overflow | 3 years ago | Sudhir
    org.springframework.beans.NotReadablePropertyException: Invalid property 'login' of bean class [springapp.service.LoginValidator]: Bean property 'login' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
  6. 0

    Create User Exception on Snapshot

    GitHub | 2 years ago | bryanhelmig
    org.springframework.beans.NotReadablePropertyException: Invalid property 'email' of bean class [org.graylog2.restclient.models.api.requests.CreateUserRequestForm]: Bean property 'email' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?

  1. abrazeneb 7 times, last 5 months ago
11 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.springframework.beans.NotReadablePropertyException

    Invalid property '_email' of bean class [org.ramanandi.matri.domain.model.User]: Bean property '_email' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?

    at org.springframework.beans.BeanWrapperImpl.getPropertyValue()
  2. Spring Beans
    BeanWrapperImpl.getPropertyValue
    1. org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:674)
    2. org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:666)
    2 frames
  3. Spring Context
    DataBinder.validate
    1. org.springframework.validation.AbstractPropertyBindingResult.getActualFieldValue(AbstractPropertyBindingResult.java:96)
    2. org.springframework.validation.AbstractBindingResult.rejectValue(AbstractBindingResult.java:103)
    3. org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:79)
    4. org.springframework.validation.DataBinder.validate(DataBinder.java:692)
    4 frames
  4. Spring
    HandlerMethodInvoker.invokeHandlerMethod
    1. org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doBind(HandlerMethodInvoker.java:797)
    2. org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:349)
    3. org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:169)
    3 frames
  5. Spring MVC
    FrameworkServlet.processRequest
    1. org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:421)
    2. org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:409)
    3. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
    4. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
    5. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
    5 frames