Spring Validator and Thymeleaf - Exception evaluating SpringEL expression: "#fields.hasErrors('*')"
<p>I'm trying to validate form's fields and I get an error that I have failed to resolve.</p>

<p><strong>myForm</strong> is a form that contains an object (a filter) called <strong>filtro</strong> that extends another filter (the base filter). And, I'm trying to validate the inherited fields of myFilter.</p>

<p><strong>HTML</strong></p>

<pre><code>&lt;form th:object="${myForm}" method="post"&gt;
    &lt;div style="padding-top: 15px;"&gt;
        &lt;input type="text" th:field="${myForm.filtro.ricercaBaseCup.descrizione}" th:errorclass="fieldError"/&gt; 
    &lt;/div&gt;              
    &lt;div padding-top: 15px;"&gt;
        &lt;input type="text" th:field="${myForm.filtro.ricercaBaseGeografico.descrizione}" th:errorclass="fieldError"/&gt;
    &lt;/div&gt;
    &lt;!--error messages--&gt;
    &lt;ul th:if="${#fields.hasErrors('*')}" style="padding:0px; color:red"&gt;
        &lt;li class='errorClass' th:each="err : ${#fields.errors('*')}" th:text="${err}"&gt;&lt;/li&gt;
    &lt;/ul&gt;
&lt;/form&gt;
</code></pre>

<p><strong>CONTROLLER</strong></p>

<pre><code>@RequestMapping(value = "/search", method = RequestMethod.GET)
public String search(@Valid @ModelAttribute("myForm") MyForm form,
                              BindingResult bindingResult, 
                              Model model){


    //Validation
    new MyFormValidator().validate(new Object[]{form}, bindingResult);
    if(bindingResult.hasErrors()){
        bindingResult.getFieldError();
        return rootPath;
    }
</code></pre>

<p><strong>VALIDATOR</strong></p>

<pre><code>public class MyFormValidator implements Validator{

@Override
public boolean supports(Class&lt;?&gt; clazz) {
    return MyForm .class.equals(clazz);
}

@Override
public void validate(Object obj, Errors errors) {
    Object[] obj = (Object[])obj;
    MyForm form = (MyForm)obj[0];

    if(form.getFiltroBase().getRicercaBaseCup().getDescrizione() != null &amp;&amp; form.getFiltroBase().getRicercaBaseCup().getDescrizione().length() &lt; 15){
        errors.rejectValue("filtro.ricercaBaseCup.descrizione", "gestOperativita.codCup.nonValido");
    }else if(form.getFiltroBase().getRicercaBaseCup().getDescrizione() == null){
        errors.rejectValue("filtro.ricercaBaseCup.descrizione", "gestOperativita.codCup.isEmpty");
    }

    if(form.getFiltroBase().getRicercaBaseGeografico().getDescrizione() == null){
        errors.rejectValue("filtro.ricercaBaseGeografico.descrizione", "gestOperativita.Ente.isEmpty");
    }
}

}
</code></pre>

<p>After <code>return rootPath;</code> instruction I refresh the html fragment containing the error messages but..</p>

<p>When I try it I get this:</p>

<blockquote>
  <p>Exception evaluating SpringEL expression: "#fields.hasErrors('*')"<br>
  (/controllaDocFinanziaria/gestioneOperativita:86) 23:23:58,603 ERROR
  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/MutuiBEI].[dispatcher]]
  (http-localhost/127.0.0.1:8080-1) JBWEB000236: Servlet.service() for
  servlet dispatcher threw exception: java.lang.NullPointerException</p>
</blockquote>