title: org.springframework.beans.NullValueInNestedPathException: auto-grow nested property path in Spring MVC 3.2.8
body: <p>I have a project based in Spring Web model-view-controller (MVC) framework. The version of the Spring Web model-view-controller (MVC) framework is 3.2.8.</p>
  
  <p>This class</p>
  
  <pre><code>public class DeviceForm {
  
      Device device;
  
      List&lt;String&gt; selectedItems = Collections.emptyList();
  
      public DeviceForm() {
          super();
      }
  
      public Device getDevice() {
          return device;
      }
  
      public void setDevice(Device device) {
          this.device = device;
      }
  
      public List&lt;String&gt; getSelectedItems() {
          return selectedItems;
      }
  
      public void setSelectedItems(List&lt;String&gt; selectedItems) {
          this.selectedItems = selectedItems;
      }
  
  
  }
  </code></pre>
  
  <p>and this</p>
  
  <pre><code>public class Device implements java.io.Serializable {
  
      @ManyToOne(fetch = FetchType.EAGER)
      @JoinColumn(name = "CRITERIA")
      private BaseCriteria criteria;
  
      public BaseCriteria getCriteria() {
          return criteria;
      }
  
      public void setCriteria(BaseCriteria criteria) {
          this.criteria = criteria;
      }
  }
  </code></pre>
  
  <p>and this</p>
  
  <pre><code>@Entity
  @Table(name = "CRITERIA")
  @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
  @DiscriminatorColumn(name = "DISCRIMINATOR", discriminatorType = DiscriminatorType.STRING)
  @SequenceGenerator(name = "seqCriteria", sequenceName = "SEQ_CRITERIA", allocationSize = 1)
  public abstract class BaseCriteria {
  
      public BaseCriteria() {
          super();
      }   
  
      private Long id;
      private String code;
      private Date adoptionDate;
      private Date expirationDate;
  
      @Transient
      public abstract String getGroupKey();
  
      @Transient
      public abstract Long getGroupId();
  
      @Transient
      public abstract String getRefColumnName();
  
      @Id
      @Column(name = "ID", unique = true, nullable = true)
      @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqCriteria")
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      @Column(name = "CODE")
      public String getCode() {
          return code;
      }
  
      public void setCode(String code) {
          this.code = code;
      }
  
      @Column(name = "ADOPTION_DATE")
      @Temporal(TemporalType.TIMESTAMP)
      public Date getAdoptionDate() {
          return adoptionDate;
      }
  
      public void setAdoptionDate(Date adoptionDate) {
          this.adoptionDate = adoptionDate;
      }
  
      @Column(name = "EXPIRATION_DATE")
      @Temporal(TemporalType.TIMESTAMP)
      public Date getExpirationDate() {
          return expirationDate;
      }
  
      @Transient
      public boolean isExpired() {
          return getExpirationDate().before(new Date());
      }
  
      public void setExpirationDate(Date expirationDate) {
          this.expirationDate = expirationDate;
      }
  
  
      @Override
      public String toString() {
          return "BaseCriteria [id=" + id + ", code=" + code + ", adoptionDate="
                  + adoptionDate + ", expirationDate=" + expirationDate + "]";
      }
  
  
  }
  </code></pre>
  
  <p>and the JSP</p>
  
  <pre><code>&lt;form:form  commandName="deviceForm"
               name="deviceForm"
               id="deviceFormId" 
               method="post"
               action="${contextPath}/newdesign/manage/device/${deviceForm.device.id}"
               htmlEscape="yes"&gt;
  
   &lt;div class="col-sm-6 text-right"&gt;
       &lt;button class="btn btn-primary" type="submit"&gt;Save device&lt;/button&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;c:forEach items="${deviceForm.device.productGroup.criteria}" var="criteria"&gt;                                                
       &lt;div class="row"&gt;                                                                                                 
              &lt;div class="col-md-3"&gt;
                  &lt;form:radiobutton path="device.criteria.id" value="${criteria.id}"/&gt;
                  &lt;label for="basic-url"&gt;Criteria:&lt;/label&gt;
                  &lt;input value="${criteria.code}" disabled="disabled" class="form-control"/&gt;
              &lt;/div&gt;
              &lt;div class="col-md-3"&gt;                                                                                                              
                  &lt;label for="basic-url"&gt;Adoption date:&lt;/label&gt;
                  &lt;input value="&lt;fmt:formatDate type="date" value="${criteria.adoptionDate}" /&gt;"      disabled="disabled" class="form-control"/&gt;
              &lt;/div&gt;                
              &lt;div class="col-md-3"&gt;                                                                                              
                  &lt;label for="basic-url"&gt;Expiration Date:&lt;/label&gt;
                  &lt;input value="&lt;fmt:formatDate type="date" value="${criteria.expirationDate}" /&gt;"    disabled="disabled" class="form-control"/&gt;
              &lt;/div&gt;                                                                                                                                            
      &lt;/div&gt;
  &lt;/c:forEach&gt;
  &lt;/form:form&gt;
  </code></pre>
  
  <p>The controller:</p>
  
  <pre><code>/**
       * @throws Exception    
       *                                 
       */
      @RequestMapping(value = {       "/newdesign/manage/device/{appId}",
                                      "/newdesign/manage/device/{appId}/"}, method = {RequestMethod.GET})
      public String viewDevicesWithStatus(                        
                                       @ModelAttribute("deviceForm") DeviceForm deviceForm,
                                       @PathVariable Long appId,                                   
                                       HttpServletRequest request,
                                       Model model ) throws Exception {
  
          Device device =   manageLicenseService.getDeviceById(appId, true);
  
          if (device.getCriteria()==null) {
              device.setCriteria(device.getProductGroup().getCriteria().get(0));
          }
  
          deviceForm.setDevice(device);       
          fillModel (model, request, device);
  
          return "cbViewDeviceInfo";      
      }
  
      /**
       * @throws Exception    
       *                                 
       */
      @RequestMapping(value = {       "/newdesign/manage/device/{appId}",
                                      "/newdesign/manage/device/{appId}/"}, method = {RequestMethod.POST})
      public String saveDevicesWithStatus(                                
                                       @ModelAttribute("deviceForm") DeviceForm deviceForm,
                                       @PathVariable Long appId,                                   
                                       HttpServletRequest request,
                                       Model model ) throws Exception {           
  
          Device device =   manageLicenseService.getDeviceById(deviceForm.getDevice().getId());
  
          if (device.getCriteria()==null) {
              device.setCriteria(device.getProductGroup().getCriteria().get(0));
          }
  
          //TODO: audit
          device.updateDevice(deviceForm.getDevice());
          manageLicenseService.saveDevice(device);    
  
          if (device.getCriteria()==null) {
              device.setCriteria(device.getProductGroup().getCriteria().get(0));
          }
  
          deviceForm.setDevice(device);
          fillModel (model, request, device);
  
  
          return "cbViewDeviceInfo";      
      }
  </code></pre>
  
  <p>But I got following error when I submitted the form, on GET method I got same page without error</p>
  
  <pre><code>org.springframework.beans.NullValueInNestedPathException: Invalid property 'device.criteria' of bean class [com.tdk.iot.controller.newdesign.manage.DeviceForm]: Could not instantiate property type [com.tdk.iot.domain.criteria.BaseCriteria] to auto-grow nested property path: java.lang.InstantiationException
  </code></pre>