3

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?

ChrisF
  • 134,786
  • 31
  • 255
  • 325
Dawid K
  • 111
  • 2
  • 5
  • possible duplicate of [contains invalid expression(s): javax.el.ELException:](http://stackoverflow.com/questions/17979369/contains-invalid-expressions-javax-el-elexception) – Raedwald Feb 26 '14 at 19:48
  • where can i look for this duplicate? i didn't add el-api to my maven dependencies. I just found two files el-api.jar, first is on tomcat/lib/el-api.jar second on IntelliJ IDEA 13.0/lib/el-api-2.2.jar. Addictional i was trying add el-api.jar in tomcat configuration inside ide, change tomcat lib to el-api2.2 nothing help.. – Dawid K Feb 26 '14 at 21:00
  • Don't edit "solved" (or similar) into your question title. Post your solution as an **answer** not an edit to the question. – ChrisF Apr 21 '14 at 20:09

0 Answers0