I have used custom api for validations which instantiated validator by Validation.buildDefaultValidatorFactory().getValidator() in quarkus based application but application throw NoProviderFoundException with below error message
Caused by: 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)
Quarkus has Hibernate Validator by default, but in my quarkus application with version 3.4.1 (Hibernate Validator-8.0.1-Final is by default dependency lib added by quarkus), the Hibernate Validator is not getting instantiated properly
I have run the same application with older quarkus version with 2.8.2 and it instantiated Hibernate Validator without issue
Confirmed the Hibernate validator by using below log
INFO [org.hib.val.int.uti.Version] (Quarkus Main Thread) HV000001: Hibernate Validator 6.2.3.Final
I need to properly instantiate Hibernate Validator to run my application. Please help me to resolve this issue.
This indicates misuse:
javax.validation
You're not using the right version of Bean Validation. The right version uses packages starting with jakarta.validation
. See https://github.com/quarkusio/quarkus/wiki/Migration-Guide-3.0#jakarta-ee-10
You need to use Jakarta Validation (jakarta.validation:jakarta.validation-api
), and align on the version that Quarkus provides (3.0.2
for Quarkus 3.4.1).
I'd also suggest using the automated tool to migrate to Quarkus 3, see https://github.com/quarkusio/quarkus/wiki/Migration-Guide-3.0#automatic-update-tool