Vaadin CDI 25 - jackson problem with java ee + wildfly

I’m having trouble migrating to Vaadin 25.
I use Vaadin CDI (Java EE Vaadin + Wildfly architecture).

The problem is with Jackson 3.
It seems to be inheriting a dependency from Jackson-Annotations 2.20, as you can see from my dependency:tree:

± com.vaadin:vaadin-cdi:jar:16.0.0:compile
| ± com.vaadin:flow-server:jar:25.0.4:compile
| | ± com.vaadin:flow-push:jar:25.0.4:compile
| | | - com.vaadin.external.atmosphere:atmosphere-runtime:jar:3.0.5.slf4jvaadin1:compile
| | ± com.vaadin:signals:jar:25.0.4:compile
| | ± org.jspecify:jspecify:jar:1.0.0:compile
| | ± tools.jackson.core:jackson-core:jar:3.0.3:compile
| | ± tools.jackson.core:jackson-databind:jar:3.0.3:compile
| | | - com.fasterxml.jackson.core:jackson-annotations:jar:2.20:compile
| | ± org.ow2.asm:asm:jar:9.9.1:compile
| | - com.vaadin.external:gentyref:jar:1.2.0.vaadin1:compile
| - com.vaadin:flow-client:jar:25.0.4:compile

This creates problems immediately during application deployment:

ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /jtorri/: java.lang.NoSuchFieldError: Class com.fasterxml.jackson.annotation.JsonFormat$Shape does not have member field ‘com.fasterxml.jackson.annotation.JsonFormat$Shape POJO’
at deployment.jtorri_main.ear.jtorri.war//tools.jackson.databind.ser.BasicSerializerFactory.buildEnumSerializer(BasicSerializerFactory.java:1071)
at deployment.jtorri_main.ear.jtorri.war//tools.jackson.databind.ser.BeanSerializerFactory._createSerializer2(BeanSerializerFactory.java:241)
at deployment.jtorri_main.ear.jtorri.war//tools.jackson.databind.ser.BeanSerializerFactory.createSerializer(BeanSerializerFactory.java:182)
at deployment.jtorri_main.ear.jtorri.war//tools.jackson.databind.SerializationContext._createAndCachePropertySerializer(SerializationContext.java:1027)
at deployment.jtorri_main.ear.jtorri.war//tools.jackson.databind.SerializationContext.findPrimaryPropertySerializer(SerializationContext.java:697)
at deployment.jtorri_main.ear.jtorri.war//tools.jackson.databind.ser.bean.BeanSerializerBase.resolve(BeanSerializerBase.java:311)
at deployment.jtorri_main.ear.jtorri.war//tools.jackson.databind.ser.UnrolledBeanSerializer.resolve(UnrolledBeanSerializer.java:155)
at deployment.jtorri_main.ear.jtorri.war//tools.jackson.databind.ser.SerializerCache.addAndResolveNonTypedSerializer(SerializerCache.java:216)
at deployment.jtorri_main.ear.jtorri.war//tools.jackson.databind.SerializationContext._createAndCacheUntypedSerializer(SerializationContext.java:975)
at deployment.jtorri_main.ear.jtorri.war//tools.jackson.databind.SerializationContext.findValueSerializer(SerializationContext.java:774)
at deployment.jtorri_main.ear.jtorri.war//tools.jackson.databind.SerializationContext.findTypedValueSerializer(SerializationContext.java:586)
at deployment.jtorri_main.ear.jtorri.war//tools.jackson.databind.ser.SerializationContextExt.valueToTree(SerializationContextExt.java:185)
at deployment.jtorri_main.ear.jtorri.war//tools.jackson.databind.ObjectMapper.valueToTree(ObjectMapper.java:1365)
at deployment.jtorri_main.ear.jtorri.war//com.vaadin.flow.server.communication.UidlWriter.dependencyToJson(UidlWriter.java:243)
at deployment.jtorri_main.ear.jtorri.war//com.vaadin.flow.server.communication.UidlWriter.lambda$groupDependenciesByLoadMode$1(UidlWriter.java:235)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at deployment.jtorri_main.ear.jtorri.war//com.vaadin.flow.server.communication.UidlWriter.groupDependenciesByLoadMode(UidlWriter.java:233)
at deployment.jtorri_main.ear.jtorri.war//com.vaadin.flow.server.communication.UidlWriter.populateDependencies(UidlWriter.java:222)
at deployment.jtorri_main.ear.jtorri.war//com.vaadin.flow.server.communication.UidlWriter.createUidl(UidlWriter.java:154)
at deployment.jtorri_main.ear.jtorri.war//com.vaadin.flow.server.communication.UidlWriter.createUidl(UidlWriter.java:207)
at deployment.jtorri_main.ear.jtorri.war//com.vaadin.flow.server.BootstrapHandler.getInitialUidl(BootstrapHandler.java:1468)
at deployment.jtorri_main.ear.jtorri.war//com.vaadin.flow.server.communication.JavaScriptBootstrapHandler.getInitialJson(JavaScriptBootstrapHandler.java:322)
at deployment.jtorri_main.ear.jtorri.war//com.vaadin.flow.server.communication.JavaScriptBootstrapHandler.synchronizedHandleRequest(JavaScriptBootstrapHandler.java:242)
at deployment.jtorri_main.ear.jtorri.war//com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:72)
at deployment.jtorri_main.ear.jtorri.war//com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1839)
at deployment.jtorri_main.ear.jtorri.war//com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:402)
at deployment.jtorri_main.ear.jtorri.war//com.vaadin.cdi.CdiVaadinServlet.service(CdiVaadinServlet.java:66)

Maybe vaadin-cdi needs to be fixed?

Which wildfly version? At least 36,37 and 38 have an issue since they put in a Jackson version incompatible with Vaadin. 39 ships Jackson 2.20 that is OK. Look at the Vaadin platform release notes for more information

I’m trying wildfly-35.0.1.Final,
but I necessarily had to exclude jacksonI from widlfy in this way

<jboss-deployment-structure>
    <deployment>
        <exclusions>
	      <module name="com.fasterxml.jackson.core.jackson-core"/>
	      <module name="com.fasterxml.jackson.core.jackson-databind"/>
	      <module name="com.fasterxml.jackson.core.jackson-annotations"/>
	      <module name="org.jboss.resteasy.resteasy-jackson2-provider"/>
	    </exclusions>
    </deployment>
</jboss-deployment-structure>

But the problem reamains

I don’t want to be wrong, but it seems to me that the problem starts with vaadin-cdi

The problem is that the version shipped by wildfly takes precedence over the version in the Vaadin application WAR and there is nothing vaadin-cdi can do there AFAIK.
For wildfly 35 you might have to exclude jaxrs submodule.

1 Like

If you think the annotation dependency has the wrong version - then you are wrong. Jackson has done this by design to allow Jackson 2 and 3 to co-exists. Both Major Version use the same annotation dependency version 2.20+

I would highly suggest to update your Wildfly.

1 Like

I solved the problem by getting the latest version of wildfly (39.0.0.Final).
Thanks everyone