Expand my Community achievements bar.

SOLVED

Issue with Jackson ObjectMapper after version upgrade

Avatar

Level 2

Good morning all,

We are upgrading our current project's AEM SDK version (AEMaaCS) from 2023.7.12697.20230713T151945Z-230601 to 2023.11.14227.20231108T162349Z-231100, however, when we do so, we are getting build errors when running unit tests against code that uses the Jackson ObjectMapper.  These errors are not present and the tests pass in the current project.  It is only when we upgrade the SDK version that we receive these errors.

 

This seems like a breaking change, but I don't see anything documented from Adobe on this.  Has anyone experienced this issue?  Any suggestions on a resolution?

 

The errors are below.  I have adjusted the namespace and class names purposefully.

 

java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/util/internal/PrivateMaxEntriesMap$Builder
at com.project.project.core.models.ClassNameTest.setResponseFromJson(ClassNameTest.java:591)
at com.project.project.core.models.ClassNameTest.setUp(ClassNameTest.java:87)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.util.internal.PrivateMaxEntriesMap$Builder
at com.project.project.core.models.ClassNameTest.setResponseFromJson(ClassNameTest.java:591)
at com.project.project.core.models.ClassNameTest.setUp(ClassNameTest.java:87)

 

[ERROR] getCardPaths_setTag Time elapsed: 0.032 s <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.databind.ObjectMapper
at com.project.project.core.models.ClassNameTest.setResponseFromJson(ClassNameTest.java:591)
at com.project.project.core.models.ClassNameTest.setUp(ClassNameTest.java:87)

1 Accepted Solution

Avatar

Correct answer by
Level 2

Followup - I did this again, but changed "jackson-core" to "jackson-databind", and it works perfectly.

 

Thank you @EstebanBustamante 

 

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>[2.12.3,)</version>
<scope>test</scope>
</dependency>

View solution in original post

7 Replies

Avatar

Community Advisor

As for the resolution try to include the Jackson dependency in your POM with TEST scope, like below:

      <dependency>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-core</artifactId>
          <version>[2.12.3,)</version>
          <scope>test</scope>
      </dependency>

Feel free to adjust the version you are using. In regards to the issue as a whole, there maybe some version change, that's my guess, but the above should solve it. 

Hope this helps

 



Esteban Bustamante

Avatar

Level 2

Hi Esteban - I did try this before posting, and now for a second time with your response, and it does not work, I still receive the same errors, which is very strange.

Avatar

Correct answer by
Level 2

Followup - I did this again, but changed "jackson-core" to "jackson-databind", and it works perfectly.

 

Thank you @EstebanBustamante 

 

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>[2.12.3,)</version>
<scope>test</scope>
</dependency>

Avatar

Community Advisor

I'm glad it worked, it results that jacskon-databind builds on top of jackson-core, so it make sense:

Here for reference.



Esteban Bustamante

Avatar

Administrator

@leeasling1 I hope you found the AEM community helpful. We look forward to your return as either a learner or a contributor. The community thrives with SMEs like you. Please encourage your AEM peers to join and contribute. Happy AEM learning!



Kautuk Sahni

Avatar

Level 2

Thanks for the suggested fix! I bumped into the exact same NoClassDefFoundError issue while upgrading from Service Pack 19 to SP21, Jackson versions 2.13.5 and 2.16.2, respectively.  Adding the dependency worked like a charm.

Avatar

Administrator

@leeasling1 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni