Null Pointer Exception from Spring MVC with Spring Session Redis Integration

I am trying to update my Spring MVC 3.2 web application to use SpringSession backed by redis. When I enable SpringSession I am getting a NullPointer exception in my controller and the reason is stupid and I am not sure if there is a clever way to solve it.

I have a ContactForm

public class ContactForm  implements java.io.Serializable {
     private EmailForm emailForm;
     public EmailForm getEmailForm() {return emailForm;}
     public void setEmailForm(EmailForm form) { emailForm = form;}
}

In my view I have the ContactForm as my modelAttribute and a reference to the email form within the ContactForm: (contactA is a ContactForm object)

<form:form  method="post" modelAttribute="contactA" id="contactA" action="add.html">
   <form:hidden path="emailForm.emailFormId"/>
</form:form>

In my Controller I am checking the emailFormId:

if(form.getEmailForm().getEmailFormId() != null) ...

Without redis this code is working fine but with redis I get a NPE. I debugged it and it is kind of silly. When the JSP de-references emailForm.emailFormId it calls the constructor on EmailForm setting it to an empty object of this Class. Without redis this updates the version in the session and everything is happy. With redis this updates the local deserialized version of the object but when I get it from the session again in my controller this change is lost and emailForm inside of the ContactForm is null.

I realize (now) I should not be relying on the behavior of the form tag to initialize my form bean but I am afraid I have this pattern in lots of places in my code and it is going to be a lot of work to fix it. Am I missing something in the view that would get it to persist it’s change back to the session or is that expecting to much?

This is the call to the constructor that is causing me trouble. It is updating the ContactForm contactA with the newly created EmailForm and I don’t have any way to persist that back to the session when the session is in redis.

11:59:32,508 ERROR [STDERR] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
11:59:32,508 ERROR [STDERR] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
11:59:32,508 ERROR [STDERR] at sun.reflect.DelegatingConstructorAccessorImpl.__newInstance(DelegatingConstructorAccessorImpl.java:27)
11:59:32,508 ERROR [STDERR] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java)
11:59:32,508 ERROR [STDERR] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java)
11:59:32,508 ERROR [STDERR] at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
11:59:32,508 ERROR [STDERR] at java.lang.Class.newInstance0(Class.java:357)
11:59:32,508 ERROR [STDERR] at java.lang.Class.newInstance(Class.java:310)
11:59:32,508 ERROR [STDERR] at org.springframework.beans.BeanWrapperImpl.newValue(BeanWrapperImpl.java:629)
11:59:32,508 ERROR [STDERR] at org.springframework.beans.BeanWrapperImpl.createDefaultPropertyValue(BeanWrapperImpl.java:604)
11:59:32,508 ERROR [STDERR] at org.springframework.beans.BeanWrapperImpl.setDefaultValue(BeanWrapperImpl.java:593)
11:59:32,508 ERROR [STDERR] at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:558)
11:59:32,508 ERROR [STDERR] at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:532)
11:59:32,508 ERROR [STDERR] at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:698)
11:59:32,509 ERROR [STDERR] at org.springframework.validation.AbstractPropertyBindingResult.getActualFieldValue(AbstractPropertyBindingResult.java:99)
11:59:32,509 ERROR [STDERR] at org.springframework.validation.AbstractBindingResult.getFieldValue(AbstractBindingResult.java:218)
11:59:32,509 ERROR [STDERR] at org.springframework.web.servlet.support.BindStatus.(BindStatus.java:120)
11:59:32,509 ERROR [STDERR] at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:179)
11:59:32,509 ERROR [STDERR] at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:199)
11:59:32,509 ERROR [STDERR] at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:165)
11:59:32,509 ERROR [STDERR] at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:152)
11:59:32,509 ERROR [STDERR] at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:143)
11:59:32,509 ERROR [STDERR] at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:127)
11:59:32,509 ERROR [STDERR] at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:421)
11:59:32,509 ERROR [STDERR] at org.springframework.web.servlet.tags.form.HiddenInputTag.writeTagContent(HiddenInputTag.java:77)
11:59:32,509 ERROR [STDERR] at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:103)
11:59:32,509 ERROR [STDERR] at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80)
11:59:32,509 ERROR [STDERR] at org.apache.jsp.WEB_002dINF.jsp.contact.maintain_005fcontact_jsp._jspx_meth_form_005fhidden_005f3(maintain_005fcontact_jsp.java:2426)
11:59:32,509 ERROR [STDERR] at org.apache.jsp.WEB_002dINF.jsp.contact.maintain_005fcontact_jsp._jspx_meth_form_005fform_005f0(maintain_005fcontact_jsp.java:1482)
11:59:32,509 ERROR [STDERR] at org.apache.jsp.WEB_002dINF.jsp.contact.maintain_005fcontact_jsp._jspService(maintain_005fcontact_jsp.java:164)