Spring MVC validation form with annotations

I tried to check with https://spring.io/guides/gs/validating-form-input/ and I added type annotations @NotNull, @Size(min = 5, max = 40). When I send the correct values, everything is fine, but when I send the wrong values, I have this error from Apache Tomcat / 7.0.47:

HTTP status 500 - handler processing failed; The nested exception is java.lang.ExceptionInInitializerError

Type of exception report

Handler processing error; The nested exception is java.lang.ExceptionInInitializerError description The server encountered an internal error that prevented it from executing this request.

exception org.springframework.web.util.NestedServletException: handler processing failed; The nested exception is java.lang.ExceptionInInitializerError

javax.el.ELException: Cannot find ExpressionFactory type: org.apache.el.ExpressionFactoryImpl

java.lang.ExceptionInInitializerError

javax.el.ELException: Cannot find ExpressionFactory type: org.apache.el.ExpressionFactoryImpl

When I update the site and try to send the wrong values ​​again, I get another error:

HTTP status 500 - handler processing failed; the nested exception is java.lang.NoClassDefFoundError: failed to initialize class org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTerm

Type of exception report

Handler processing error; the nested exception is java.lang.NoClassDefFoundError: failed to initialize class org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTerm

, .

exception org.springframework.web.util.NestedServletException: ; - java.lang.NoClassDefFoundError: org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTerm

java.lang.NoClassDefFoundError: org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTerm

:

@RequestMapping(value = "testform", method=RequestMethod.GET)
public String testForm(Foo foo){
    return "test/testform";
}

@RequestMapping(value="testform", method=RequestMethod.POST)
public String checkPersonInfo(@Valid Foo foo, BindingResult bindingResult) {
    if (bindingResult.hasErrors()) {
        return "test/testform";
    }
    return "redirect:/admin/venue/testform";
}

:

<form action="#" th:action="@{/admin/venue/testform}" th:object="${foo}" method="post">
<table>
    <tr>
        <td>Name:</td>
        <td><input type="text" th:field="*{name}" /></td>
        <!--<td th:if="${#fields.hasErrors('name')}" th:errors="*{name}">Name Error</td>-->
    </tr>
    <tr>
        <td><button type="submit">Submit</button></td>
    </tr>
</table>

, ? , Tomcat ?

+3

All Articles