Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I am getting "Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath." this error when try to implement the Validation for my Entity (ProductInstance)
Here is the Usage
try {
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
for (ConstraintViolation<ProductInstance> violation : validator.validate(product)) {
genActResponse.addErrorMessage(violation.getMessage());
genActResponse.addFailure();
return genActResponse;
} catch (Exception e) {
throw e;
Here is the Dependency in gradle.build
dependencies {
compile group: 'org.hibernate', name: 'hibernate-validator-annotation-processor', version: '6.0.2.Final'
And here is the error I am getting
2018-12-03 20:22:12,420 WebErrorHandler ERROR - General exception
javax.validation.NoProviderFoundException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:291)
at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:103)
at com.helpsystems.incn.access.service.DefaultProductInstanceService.updateProduct(DefaultProductInstanceService.java:200)
at com.helpsystems.incn.server.ProductInstanceController.updateProduct(ProductInstanceController.java:95)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
For Gradle, add:
compile group: 'org.hibernate', name: 'hibernate-validator', version: '6.0.13.Final'
For Maven, add:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.13.Final</version>
</dependency>
You can adjust the version based on other dependencies versions'
–
–
If you are using SpringBoot, you can add the following library :
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.