Skip to content

The objectMapper.findAndRegisterModules() not registering modules in quarkus-logging-json in native mode #305

@idachev

Description

@idachev

Describe the bug

If the JavaTimeModule class is available, I expect the ObjectMapper used by quarkus-logging-json to register it as a module.

That does not happen in native build.

Expected behavior

If the JavaTimeModule class is available, I expect the ObjectMapper used by quarkus-logging-json to register it as a module.

Actual behavior

This exception is thrown:

Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Java 8 date/time type `java.time.Instant` not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling

How to Reproduce?

A simple code to test:

Map<String, Object> event = new HashMap<>();
event.put("time", Instant.now());

log.info("Test msg", kv("event", event));

That will not dump any json message and will log an error that jsr310 should be registered.

Output of uname -a or ver

5.15.0-86-generic #96-Ubuntu SMP Wed Sep 20 08:23:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk 17.0.8.1 2023-08-24

Mandrel or GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.2.6.Final

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions