I was trying to perform validation with https://spring.io/guides/gs/validating-form-input/ and I added annotations like @NotNull, @Size(min = 5, max = 40)
. When I send correct values everything is fine, but when I send wrong values firstly I have this error from Apache Tomcat/7.0.47:
HTTP Status 500 - Handler processing failed; nested exception is java.lang.ExceptionInInitializerError
type Exception report
message Handler processing failed; nested exception is java.lang.ExceptionInInitializerError description The server encountered an internal error that prevented it from fulfilling this request.
exception org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.ExceptionInInitializerError
javax.el.ELException: Unable to find ExpressionFactory of type: org.apache.el.ExpressionFactoryImpl
java.lang.ExceptionInInitializerError
javax.el.ELException: Unable to find ExpressionFactory of type: org.apache.el.ExpressionFactoryImpl
When I refresh the site and try sending wrong values again I get a different error:
HTTP Status 500 - Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTerm
type Exception report
message Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTerm
description The server encountered an internal error that prevented it from fulfilling this request.
exception org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTerm
java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTerm
This is the action in my controller:
@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";
}
And view:
<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>
Any ideas how to resolve this problem? Maybe Tomcat is missing some libs?