zalando/logbook

Support native compilation with graalvm

Closed this issue · 8 comments

You could support graalvm native compilation.
Currently it is not working, some exception occur:
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.zalando.logbook.json.JsonHttpLogFormatter$JsonBody and no properties discovered to create BeanSerializer

Detailed Description

Define reflect-config.json files as explained in graalvm documentation.

Context

Can use logbook when going native

In my case I was able to solve the problem in a Spring Boot application adding the following content into the file: src/main/resources/META-INF/native-image/org.zalando/logbook/reflect-config.json:

[
    {
      "name" : "org.zalando.logbook.json.JsonHttpLogFormatter$JsonBody",
      "allPublicMethods" : true
    }
]

Thanks @itineric for the tip.

you can do that with only one step:
rename your file reflection-config.json to reflect-config.json and place it inside src/main/resources/META-INF/native-image/<group id>/<artifact id> it will be picked up automatically.

It you are using Spring, you can also use ReflectionHints instead.

My point here is that this reflection config could be added directly to the logbook lib then no extra (external) configuration is required.

@itineric, thanks for the tip. I updated the answer. My goal was to help those who are facing same problem, while the solution is not added directly to the logbook.

Looks like a nice addition to logbook. @itineric would you be interested in contributing to the library to add the necessary changes?

In order to prioritize the support for Logbook, we would like to check whether the old issues are still relevant.
This issue has not been updated for over six months.

  • Please check if it is still relevant in latest version of the Logbook.
  • If so, please add a descriptive comment to keep the issue open.
  • Otherwise, the issue will automatically be closed after a week.

Could be something that we look into in the future. Let's not close the issue yet.

In order to prioritize the support for Logbook, we would like to check whether the old issues are still relevant.
This issue has not been updated for over six months.

  • Please check if it is still relevant in latest version of the Logbook.
  • If so, please add a descriptive comment to keep the issue open.
  • Otherwise, the issue will automatically be closed after a week.

This issue has automatically been closed due to no activities. If the issue still exists in the latest version of the Logbook, please feel free to re-open it.