I added some validation (@NotNull) to managed beans and suddenly got this error. Any ideas what might cause it? The application runs in Apache Tomcat 7.
javax.validation.ValidationException: Unable to find a default provider
javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
javax.faces.validator.BeanValidator.validate(BeanValidator.java:271)
javax.faces.component.UIInput.validateValue(UIInput.java:1127)
javax.faces.component.UIInput.validate(UIInput.java:941)
javax.faces.component.UIInput.executeValidate(UIInput.java:1189)
javax.faces.component.UIInput.processValidators(UIInput.java:691)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1080)
javax.faces.component.UIForm.processValidators(UIForm.java:243)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1080)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1080)
javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1180)
com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
It appears that there is no JSR 303 Bean Validation provider in the classpath of your application in the application server. If you are using Glassfish, it would be better if you can verify the presence of
bean-validator.jarin the$GLASSFISH_INSTALL_ROOT/glassfish/modulesdirectory; Glassfish 3.1 uses this JAR (which contains the Hibernate Validator implementation) to serve as the default JSR 303 Bean Validation provider. I suspect that you are using an older version of Glassfish, or another application server that does not contain a Bean Validation provider.If you must include a Bean Validation provider in the classpath, consider reading the Java API documentation for the
ValidationProviderResolverinterface, which states that:Therefore, if you do include a Bean Validation provider in your classpath manually, you must ensure the presence of the
META-INF/services/javax.validation.spi.ValidationProviderfile in the classpath, and also that it contains the name of the Bean Validation provider. The contents of one provided by Glassfish is listed below, and points to the Hibernate Bean Validator class: