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

UnexpectedTypeException: HV000030: No validator could be found for constraint 'javax.validation.constraints.Size' validating type 'java.lang.String'

Ask Question

I am getting this error when running integration tests for an endpoint in Quarkus. I make a POST request passing a valid object as body. Method signature:

 @POST
 public Response myMethodPost(@Valid MyObjData myObjData);

I get the following error:

javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'javax.validation.constraints.Size' validating type 'java.lang.String'. Check configuration for 'myMethodPost.arg0.dataId'

Where dataId is a property of MyObjData of type String. I have also included the following Maven dependencies:

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-resteasy-jsonb</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-hibernate-validator</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-resteasy</artifactId>
        </dependency>

Quarkus won't scan classes that are in other modules or jars, so it fails to register the validators at start up.

I had to add the org.kordamp.gradle.jandex gradle plugin to my submodule in order for Quarkus to see the annations.

Discussion here: https://github.com/quarkusio/quarkus/issues/13233

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.