Search code examples
jakarta-eetomcatbean-validationhibernate-validator

Using javax.validation with Tomcat7


I'm trying to get javax.validation working on Tomcat 7.

Ive got in my WEB_INF/lib: hibernate-validator-4.3.0 as well as slf4j-api-1.7.1 and slf4j-simple-1.7.1.

When I run my code, the validation is just ignored! Its all working fine on glassfish, has anyone else had this problem?

Cheers! NFV


Solution

  • You need the validation-api.jar as well. It contains the Bean Validation API including the bootstrapping classes (javax.validation.Validation).

    Perhaps you downloaded the loose JAR files instead of the distribution bundle. You can download the currently latest 4.3.0 release as zip here. It contains all the files you need to drop in /WEB-INF/lib. After extracting the zip, you can find the validation-api.jar in the /lib/required folder.