Skip to content

PiT 25.1: Quarkus dev mode fails with NoClassDefFoundError: JsonSerializeAs due to Jackson 2.x/3.x conflict #271

@manolo

Description

@manolo

Description

Quarkus dev mode fails to start with NoClassDefFoundError: com/fasterxml/jackson/annotation/JsonSerializeAs when the Vaadin BOM is placed before the Quarkus BOM in dependencyManagement.

PiT (Platform in Test) reorders the BOMs so Vaadin BOM comes first. This is needed so that the Vaadin version under test takes precedence over the version pinned by Quarkus Platform. However, this causes Jackson 3.x (from Vaadin BOM/flow-server) to win over Jackson 2.x (from Quarkus BOM), breaking Vert.x which depends on Jackson 2.x.

Root cause

In Maven, the first BOM in dependencyManagement wins for version resolution:

  • Vaadin BOM first (PiT order): flow-server brings tools.jackson.core:jackson-databind:3.0.4 (Jackson 3.x), which pulls com.fasterxml.jackson.core:jackson-annotations:2.20 as a bridge. Vert.x's DatabindCodec fails because JsonSerializeAs is not available.
  • Quarkus BOM first (default order): Quarkus manages com.fasterxml.jackson.core:jackson-core:2.21.1 (Jackson 2.x), which is compatible with Vert.x.

The underlying issue is that flow-server depends on Jackson 3.x (tools.jackson.core), which is incompatible with Quarkus/Vert.x that uses Jackson 2.x. When both are on the classpath and Jackson 3.x wins resolution, the Vert.x classloader fails.

Dependency tree (relevant parts)

io.vertx:vertx-core:4.5.25
  \- com.fasterxml.jackson.core:jackson-core:jar:2.21.1:compile

com.vaadin:flow-server:25.0.7
  +- tools.jackson.core:jackson-core:jar:3.0.4:compile
  +- tools.jackson.core:jackson-databind:jar:3.0.4:compile
  |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.20:compile

Stack trace

ERROR [io.quarkus.deployment.dev.IsolatedDevModeMain] Failed to start quarkus:
  Build step io.quarkus.devui.deployment.BuildTimeContentProcessor#createBuildTimeConstJsTemplate
  threw an exception: java.lang.NoClassDefFoundError: com/fasterxml/jackson/annotation/JsonSerializeAs
    at io.vertx.core.json.jackson.DatabindCodec.<clinit>(DatabindCodec.java:36)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.annotation.JsonSerializeAs

Steps to reproduce

mvn -ntp -q -B io.quarkus.platform:quarkus-maven-plugin:create \
  -Dextensions=rest,vaadin -DwithCodestart \
  -DprojectGroupId=com.vaadin.starter -DprojectArtifactId=vaadin-quarkus

cd vaadin-quarkus

Then swap the BOM order in pom.xml so vaadin-bom comes before quarkus-bom in <dependencyManagement>:

<dependencyManagement>
    <dependencies>
        <!-- Vaadin BOM first (triggers the bug) -->
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-bom</artifactId>
            <version>${vaadin.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <!-- Quarkus BOM second -->
        <dependency>
            <groupId>${quarkus.platform.group-id}</groupId>
            <artifactId>${quarkus.platform.artifact-id}</artifactId>
            <version>${quarkus.platform.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

Then run:

mvn -Dquarkus.enforceBuildGoal=false quarkus:dev

With default BOM order (Quarkus first), it works fine.

Why this matters

PiT needs to reorder the BOMs to test newer Vaadin versions against a Quarkus project. Without the reorder, the Quarkus BOM pins the Vaadin version and PiT cannot test the target version. The vaadin-quarkus-extension should be able to handle both BOM orderings, or flow-server should not leak Jackson 3.x into the classpath in a way that conflicts with Jackson 2.x.

Environment

  • Quarkus: 3.32.2
  • Vaadin: 25.0.6 (flow-server 25.0.7)
  • Java: 21
  • OS: macOS / Linux (both affected)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    Status

    🔎Iteration reviews

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions