org.springframework.beans.NullValueInNestedPathException

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.

  • AbstractPropertyAccessor ignoring NullValueInNestedPathException in setPropertyValue method when ignoreUnknown is set to true When trying to bind to a root object that is an instance of a map, the property name like 'models[user].firstName' triggers a NullValueInNestedPathException if the key 'user' does not exist in the map. This condition is equivalent to a property name 'user.fullName' to be applied on an object User which does not have a property fullName, which in turn would throw a NonWritablePropertyException, and thus be caught if ignoreUnknown flag is set to true and prevent the stack to propagate further up, instead completing the binding. The condition when a parameter like that could be submitted by the web form and yet not to belong to this form-backing object is easily created when using Spring Web Flow, which allows one form to be posted to multiple FormAction hanlers, each of them could contain its own section of the form (a component, so to call) which is bindied independantly. i.e. <input name="models[user].firstName"/> <input name="models[user].lastName"/> <input name="models[address].street"/> <input name="models[address].city"/> Where the 'user' and 'address' keys are different objects in a map and are being processed by separate Action classes in SWF. ====================================== 5:34:51,419 ERROR [[springdispatcher]] Servlet.service() for servlet springdispatcher threw exception org.springframework.webflow.ActionExecutionException: Exception thrown executing [AnnotatedAction@48075 targetAction = ....main.action.TravelerInfoAction@5c80e8, attributes = map['method' -> 'bind']] in state 'travelerInformation' of flow 'bookingpath' -- action execution properties where 'map['method' -> 'bind']'; nested exception is org.springframework.beans.NullValueInNestedPathException: Invalid property 'models[user]' of bean class [....component.Form]: Value of nested property 'models[user]' is null Caused by: org.springframework.beans.NullValueInNestedPathException: Invalid property 'models[user]' of bean class [....component.Form]: Value of nested property 'models[user]' is null at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:387) at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:362) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:568) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValue(AbstractPropertyAccessor.java:49) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:68) at org.springframework.validation.DataBinder.applyPropertyValues(DataBinder.java:478) at org.springframework.validation.DataBinder.doBind(DataBinder.java:393) at org.springframework.web.bind.WebDataBinder.doBind(WebDataBinder.java:146) at org.springframework.validation.DataBinder.bind(DataBinder.java:378) at org.springframework.webflow.action.FormAction.doBind(FormAction.java:632) at ....actionhandlers.Action.doBind(Action.java:320) at org.springframework.webflow.action.FormAction.bind(FormAction.java:536) at ....actionhandlers.Action.bind(Action.java:62)
    via by Alex Antonov,
  • AbstractPropertyAccessor ignoring NullValueInNestedPathException in setPropertyValue method when ignoreUnknown is set to true When trying to bind to a root object that is an instance of a map, the property name like 'models[user].firstName' triggers a NullValueInNestedPathException if the key 'user' does not exist in the map. This condition is equivalent to a property name 'user.fullName' to be applied on an object User which does not have a property fullName, which in turn would throw a NonWritablePropertyException, and thus be caught if ignoreUnknown flag is set to true and prevent the stack to propagate further up, instead completing the binding. The condition when a parameter like that could be submitted by the web form and yet not to belong to this form-backing object is easily created when using Spring Web Flow, which allows one form to be posted to multiple FormAction hanlers, each of them could contain its own section of the form (a component, so to call) which is bindied independantly. i.e. <input name="models[user].firstName"/> <input name="models[user].lastName"/> <input name="models[address].street"/> <input name="models[address].city"/> Where the 'user' and 'address' keys are different objects in a map and are being processed by separate Action classes in SWF. ====================================== 5:34:51,419 ERROR [[springdispatcher]] Servlet.service() for servlet springdispatcher threw exception org.springframework.webflow.ActionExecutionException: Exception thrown executing [AnnotatedAction@48075 targetAction = ....main.action.TravelerInfoAction@5c80e8, attributes = map['method' -> 'bind']] in state 'travelerInformation' of flow 'bookingpath' -- action execution properties where 'map['method' -> 'bind']'; nested exception is org.springframework.beans.NullValueInNestedPathException: Invalid property 'models[user]' of bean class [....component.Form]: Value of nested property 'models[user]' is null Caused by: org.springframework.beans.NullValueInNestedPathException: Invalid property 'models[user]' of bean class [....component.Form]: Value of nested property 'models[user]' is null at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:387) at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:362) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:568) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValue(AbstractPropertyAccessor.java:49) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:68) at org.springframework.validation.DataBinder.applyPropertyValues(DataBinder.java:478) at org.springframework.validation.DataBinder.doBind(DataBinder.java:393) at org.springframework.web.bind.WebDataBinder.doBind(WebDataBinder.java:146) at org.springframework.validation.DataBinder.bind(DataBinder.java:378) at org.springframework.webflow.action.FormAction.doBind(FormAction.java:632) at ....actionhandlers.Action.doBind(Action.java:320) at org.springframework.webflow.action.FormAction.bind(FormAction.java:536) at ....actionhandlers.Action.bind(Action.java:62)
    via by Alex Antonov,
  • Pair-Map in Spring Form bean
    via Stack Overflow by dtrunk
    ,
  • Java Spring Bean error
    via Stack Overflow by RaduNica
    ,
  • problem with submit: NullValueInNestedPathException:
    via by Alejandro Perez,
    • org.springframework.beans.NullValueInNestedPathException: Invalid property 'models[user]' of bean class [....component.Form]: Value of nested property 'models[user]' is null at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:387) at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:362) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:568) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValue(AbstractPropertyAccessor.java:49) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:68) at org.springframework.validation.DataBinder.applyPropertyValues(DataBinder.java:478) at org.springframework.validation.DataBinder.doBind(DataBinder.java:393) at org.springframework.web.bind.WebDataBinder.doBind(WebDataBinder.java:146) at org.springframework.validation.DataBinder.bind(DataBinder.java:378) at org.springframework.webflow.action.FormAction.doBind(FormAction.java:632)

    Users with the same issue

    qavid
    4 times, last one,
    Unknown visitor1 times, last one,