-
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
Vert.x 4 Serialization error (Native mode) #16555
Comments
Yes, this case cannot be easily tracked. |
BTW, was it working with the 1.x version? |
I had an issue with a 3rd party library I created that uses gson. To my surprise, gson itself basically works without a problem in the native, barring the fact that the objects were incorrectly empty. but, it was only when I saw this syntax above that I discovered how to annotate 3rd party library classes inside the main project: @RegisterForReflection(targets = {User.class, UserImpl.class}) Where User and UserImpl could be in a utility jar. Sort of off topic, but just wanted a quick way to suggest that the documentation have this added in various locations as I read a ton of documentation yet never saw this usage. Only here in this Issue did I discover it. Saved the day!!! Thanks! |
- add an example with multiple classes registered - add a canonical example - link the section in the various guides mentioning the @RegisterForReflection annotation Fix quarkusio#16555.
Describe the bug
Quarkus: 2.X Native mode.
I am working in a Vert.x application over Quarkus 2.x and I am getting the following error when I am trying to encode a
io.vertx.ext.auth.User
into a Json String through this methodJson.encode(user)
(Note that the user is empty).Error:
I have tried to register an auth "user", for reflection through a
reflection-config.json
file or by a@RegisterForReflection(targets = {User.class, UserImpl.class})
annotation without success.For example:
In the end following the error recommendation we have created a custom object mapper used by Vertx
Json.encode
library.You have a reproducer in this project over this module. You could clone the project, remove the class
io.quarkus.qe.vertx.web.config.VertxAuthObjectMapperCustomizer
and run the following command:mvn clean install -pl 302-quarkus-vertx-jwt -P native
Another way to reproduce the issue is just to create a simple Vertx app for example with Reactive-routes:
Dependencies:
And then create the following endpoint:
Make a native compilation and then make a request to
http://localhost:8080/test/hello/
Or even forget about
io.vertx:vertx-auth-jwt
IF you have a "RandomObject" like
And then you try to serialize as a Json, is going to fail (native mode):
Query:
curl -v http://localhost:8080/test/hello/
Result:
The text was updated successfully, but these errors were encountered: