micronaut-guides icon indicating copy to clipboard operation
micronaut-guides copied to clipboard

Add `@ReflectiveAccess` to the fruit type in the mongodb guide

Open CarlosPavajeau opened this issue 2 years ago • 7 comments

Expected Behavior

Receive a valid HTTP Response

Actual Behaviour

{"message":"Internal Server Error","_links":{"self":{"href":"/fruits","templated":false}},"_embedded":{"errors":[{"message":"Internal Server Error: Can't find a codec for class example.micronaut.Fruit."}]}}

Steps To Reproduce

  1. Go to https://guides.micronaut.io/latest/micronaut-mongodb-asynchronous-gradle-kotlin.html and dowload source code
  2. Create a docker container with docker (Optional, for local test); you can set the mongodb.uri parameter with your database connection string
  3. Generate a native file with GraalVM
  4. Run native binary
  5. Run curl -i localhost:8080/fruits following the example of the guide, you can also execute the POST, the error appears in both methods
  6. You maybe receive a response like {"message":"Internal Server Error","_links":{"self":{"href":"/fruits","templated":false}},"_embedded":{"errors":[{"message":"Internal Server Error: Can't find a codec for class example.micronaut.Fruit."}]}}

Environment Information

  • Operating System: Ubuntu 22.04 LTS (It also happens in a kubernetes cluster)
  • JDK Version: 11
  • GraalVM: 22.0.0.2.r11-grl (recommended in the tutorial for java 11)

Example Application

https://guides.micronaut.io/latest/micronaut-mongodb-asynchronous-gradle-kotlin.html

Version

3.4.1

CarlosPavajeau avatar May 08 '22 18:05 CarlosPavajeau