Open dcoracle opened 10 months ago
This could be a red herring but the issue sounds very similar to this: https://github.com/micronaut-projects/micronaut-core/issues/7179
There are two reasons why this may not work:
reflect-config.json
(native image specific configuration file), as otherwise they will not work at runtime (e.g. you get an empty object with no field and methods)If you create the following file (assuming Maven project):
src/main/resources/META-INF/native-image/groupId/artifactId/reflect-config.json
with the following content:
[
{
"name": "your.package.Message2",
"allPublicMethods": true
}
]
your problem should be fixed
Thank you for the quick response tomas. Your suggestion worked. I must admit I am new to native images so I was just following and trying to adapt our microservices based on this: https://helidon.io/docs/v4/mp/guides/graalnative
Maybe as feedback, some quick blurb in the documentation can be said about reflection (or maybe a sample file can be added to the quickstart archetype)
Thanks again
Getting {} as a JSON response to a REST endpoint when compiling to native-image
Environment Details
Problem Description
Problem occured as I was exploring the migration to native-image. All of our helidon microservices use lombok for our beans and jakarta.ws.rs.core.Response to construct responses to our REST-based endpoints. When building and running as a java application, everything works fine and the JSON response is correct. When compiling to native image, I get {} as the response. No errors in the stacktrace
Steps to reproduce