-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jakarta Bean Validators not working in native mode for CloudEvents api #7686
Comments
CloudEvent is not able to build the Quarkus initializes a What you can do is to inject the This method has been specifically added for Quarkus. |
Thanks a lot Guillaume! It's working fine now. The code is updated in github but I add here the changes for future references: I have injected the Validator in EventService class: And add a
|
I'd like to propose an additional section `Native compilation` describing how to use the `Validator` to avoid running into quarkusio/quarkus#7686
I'd like to propose an additional section `Native compilation` describing how to use the `Validator` to avoid running into quarkusio#7686
I'd like to propose an additional section `Native compilation` describing how to use the `Validator` to avoid running into quarkusio#7686
I'd like to propose an additional section `Native compilation` describing how to use the `Validator` to avoid running into quarkusio#7686 (cherry picked from commit 1be06ed)
Hi All,
I'm working in a quarkus project using sdk-java api to create and receive events into a kubernetes cluster. If we execute the project using the JVM it is working fine, but when I launch it as a native image I see the error below:
javax.validation.NoProviderFoundException: Unable to create a Configuration, because no Jakarta Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
The problem seems to be in the validations included in cloudevents/sdk-java pom.xml:
Expected behavior
Validations should work fine in JVM and Native.
Actual behavior
When executing in native mode we see an exception:
javax.validation.NoProviderFoundException: Unable to create a Configuration, because no Jakarta Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
To Reproduce
Steps to reproduce the behavior:
./mvnw quarkus:dev
localhost:8080/event-sample
with headerContent-Type:application/json
and body{"code":1,"value":"This is a test"}
./mvnw package -Pnative
target/quarkus-cloudevent-sample-1.0-SNAPSHOT-runner
localhost:8080/event-sample
with headerContent-Type:application/json
and body{"code":1,"value":"This is a test"}
javax.validation.NoProviderFoundException: Unable to create a Configuration, because no Jakarta Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
And, in logs, you can check that the cloud event was not created properly:
Configuration
All the configuration is available in github project
Screenshots
Screenshots previously shared.
Environment (please complete the following information):
uname -a
orver
:Darwin MacBook-Pro-de-Julio.local 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64
java -version
:mvnw --version
orgradlew --version
):Additional context
No additional context needed.
The text was updated successfully, but these errors were encountered: