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.

  • It seems that a Backing Bean (formObject) for a FormAction can't handle nested properties. I have a formObject with 2 references to Address objects (homeAddress and workAddress). They are set to new Address instances via the Constuctor of the formObject. When I debug, I see that the formObject is well instanciated via the createFormObject(context); in the FormAction class. Via Inspect I also saw that both address properties where pointing to Address objects. All very good. But when the view is processed I get this error: org.springframework.beans.NullValueInNestedPathException: Invalid property 'homeAddress' of bean class [my.company.web.action.LiteratureFormAction$FormObject]: Value of nested property 'homeAddress' is null at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:443) at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:418) at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:524) at org.springframework.validation.AbstractPropertyBindingResult.getActualFieldValue(AbstractPropertyBindingResult.java:77) at org.springframework.validation.AbstractBindingResult.getFieldValue(AbstractBindingResult.java:337) at org.springframework.validation.BindException.getFieldValue(BindException.java:206) at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:117) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:179) at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.resolveCssClass(AbstractHtmlElementTag.java:404) at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:380) at org.springframework.web.servlet.tags.form.AbstractHtmlInputElementTag.writeDefaultAttributes(AbstractHtmlInputElementTag.java:177) at org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:139) at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:93) at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:77) at jsp_servlet._pages._requestmaterial.__form._jspService(__form.java:770) at weblogic.servlet.jsp.JspBase.service(JspBase.java:33) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:463) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:97) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:166) at org.acegisecurity.util.FilterChainProxy$VirtualFilter
    via by Bert Van der Heyden,
  • It seems that a Backing Bean (formObject) for a FormAction can't handle nested properties. I have a formObject with 2 references to Address objects (homeAddress and workAddress). They are set to new Address instances via the Constuctor of the formObject. When I debug, I see that the formObject is well instanciated via the createFormObject(context); in the FormAction class. Via Inspect I also saw that both address properties where pointing to Address objects. All very good. But when the view is processed I get this error: org.springframework.beans.NullValueInNestedPathException: Invalid property 'homeAddress' of bean class [my.company.web.action.LiteratureFormAction$FormObject]: Value of nested property 'homeAddress' is null at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:443) at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:418) at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:524) at org.springframework.validation.AbstractPropertyBindingResult.getActualFieldValue(AbstractPropertyBindingResult.java:77) at org.springframework.validation.AbstractBindingResult.getFieldValue(AbstractBindingResult.java:337) at org.springframework.validation.BindException.getFieldValue(BindException.java:206) at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:117) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:179) at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.resolveCssClass(AbstractHtmlElementTag.java:404) at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:380) at org.springframework.web.servlet.tags.form.AbstractHtmlInputElementTag.writeDefaultAttributes(AbstractHtmlInputElementTag.java:177) at org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:139) at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:93) at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:77) at jsp_servlet._pages._requestmaterial.__form._jspService(__form.java:770) at weblogic.servlet.jsp.JspBase.service(JspBase.java:33) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:463) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:97) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:166) at org.acegisecurity.util.FilterChainProxy$VirtualFilter
    via by Bert Van der Heyden,
  • I use the following validation rules: {deal: ? not null : 'deal' : 'errors.required.deal' : 101} {deal.client: ? not null : 'deal client' : 'errors.required.deal.client' : 102} I have deal != null and deal.client ==null. The second rule have to find this issue and add error into collection. But, i get the following error: org.springframework.beans.NullValueInNestedPathException: Invalid property 'deal.client' of bean class [com.db.gcf.gbcrm.pipelinedeals.pipelinedeals.web.webflows.actions.PlDealsDealFormBean]: Value of nested property 'deal.client' 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.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:363) at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:468) at org.springmodules.validation.valang.functions.BeanPropertyFunction.getResult(BeanPropertyFunction.java:59) at org.springmodules.validation.valang.predicates.GenericTestPredicate.evaluate(GenericTestPredicate.java:60) at org.springmodules.validation.valang.predicates.BasicValidationRule.validate(BasicValidationRule.java:124) at org.springmodules.validation.valang.ValangValidator.validate(ValangValidator.java:194) at com.db.gcf.gbcrm.pipelinedeals.pipelinedeals.web.webflows.PlDealsEditValidationTest.testMandatoryFields(PlDealsEditValidationTest.java:36) ... In my opinion you must catch this exception and pass null value into parser. Note, that in general i can't use standalone validator for standalone objects as rules are generally interconnected between objects tree.
    via by Sergey Ponomarev,
  • I use the following validation rules: {deal: ? not null : 'deal' : 'errors.required.deal' : 101} {deal.client: ? not null : 'deal client' : 'errors.required.deal.client' : 102} I have deal != null and deal.client ==null. The second rule have to find this issue and add error into collection. But, i get the following error: org.springframework.beans.NullValueInNestedPathException: Invalid property 'deal.client' of bean class [com.db.gcf.gbcrm.pipelinedeals.pipelinedeals.web.webflows.actions.PlDealsDealFormBean]: Value of nested property 'deal.client' 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.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:363) at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:468) at org.springmodules.validation.valang.functions.BeanPropertyFunction.getResult(BeanPropertyFunction.java:59) at org.springmodules.validation.valang.predicates.GenericTestPredicate.evaluate(GenericTestPredicate.java:60) at org.springmodules.validation.valang.predicates.BasicValidationRule.validate(BasicValidationRule.java:124) at org.springmodules.validation.valang.ValangValidator.validate(ValangValidator.java:194) at com.db.gcf.gbcrm.pipelinedeals.pipelinedeals.web.webflows.PlDealsEditValidationTest.testMandatoryFields(PlDealsEditValidationTest.java:36) ... In my opinion you must catch this exception and pass null value into parser. Note, that in general i can't use standalone validator for standalone objects as rules are generally interconnected between objects tree.
    via by Sergey Ponomarev,
  • 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,
    • org.springframework.beans.NullValueInNestedPathException: Invalid property 'homeAddress' of bean class [my.company.web.action.LiteratureFormAction$FormObject]: Value of nested property 'homeAddress' is null at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:443) at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:418) at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:524) at org.springframework.validation.AbstractPropertyBindingResult.getActualFieldValue(AbstractPropertyBindingResult.java:77) at org.springframework.validation.AbstractBindingResult.getFieldValue(AbstractBindingResult.java:337) at org.springframework.validation.BindException.getFieldValue(BindException.java:206) at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:117) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:179) at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.resolveCssClass(AbstractHtmlElementTag.java:404) at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:380) at org.springframework.web.servlet.tags.form.AbstractHtmlInputElementTag.writeDefaultAttributes(AbstractHtmlInputElementTag.java:177) at org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:139) at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:93) at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:77) at jsp_servlet._pages._requestmaterial.__form._jspService(__form.java:770) at weblogic.servlet.jsp.JspBase.service(JspBase.java:33) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:463) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:97) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:166)

    Users with the same issue

    Unknown visitor1 times, last one,