MaxL
MaxL

Reputation: 276

Jackson version with Maven in SpringBoot 2.3

When I update my project from SpringBoot 2.2.7 to 2.3.0, I encounter the following error when launching:

Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ser.std.ToStringSerializerBase
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[na:na]

I don't see any errors in Eclipse after the update. I specify that I don't use Jackson directly in my pom.xml, but only external packages which use it (from mvnrepository.com).

So I think it was related to Jackson's upgrade from 2.10 to 2.11, and probably a Maven dependency from external package (jjwt-jackson use 2.9 for example).

In pom.xml, I see this:

Before (SpringBoot 2.9.7) : enter image description here

After (SpringBoot 2.3.0) : enter image description here

Can my explanation be correct ? And is there a solution with pom.xml (or anything else) to resolve this kind of problem ?

Upvotes: 4

Views: 6224

Answers (2)

Smile
Smile

Reputation: 4088

Use maven exclusions and exclude 2.9 & 2.10 versions from jjwt-jackson & springdoc-openapi-ui in your pom file.

Upvotes: 2

Karol Dowbecki
Karol Dowbecki

Reputation: 44980

It looks like you are mixing up three different Jackson versions:

  • 2.9 e.g. jackson-databind-2.9.10.3
  • 2.10 e.g. jackson-dataformat-yaml-2.10.1
  • 2.11 e.g. jackson-datatype-jdk8-2.11.0

This is not going to work, you must use the same Jackson version. Your particular problem with missing ToStringSerializerBase comes from using 2.9 with 2.10+.

Upvotes: 5

Related Questions