Upgrading Uber Jar from AEM 6.5.5 to 6.5.17 creates issues in Google Gson resolving in test classes | Community
Skip to main content
Level 3
August 3, 2023
Solved

Upgrading Uber Jar from AEM 6.5.5 to 6.5.17 creates issues in Google Gson resolving in test classes

  • August 3, 2023
  • 1 reply
  • 1181 views

Hi,

I have recently upgraded our instance from 6.5.5 to 6.5.17 , so when I am changing the Uber Jar version there were issue in classifier which I removed and UBER jar is loading fine. But Google GSON API is not getting resolved in Test classes and getting following error wherever GSON is used.

 

 

java.lang.NoSuchMethodError: com.google.gson.internal.ConstructorConstructor.<init>(Ljava/util/Map;)V at com.google.gson.Gson.<init>(Gson.java:209) at com.google.gson.Gson.<init>(Gson.java:188)

 

Anybody experience this before? Any Suggestions?

I have already imported Google API in core dependency still after upgrading I am getting this issue.

 

<dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.10.1</version> <scope>test</scope> </dependency>

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sady_Rifat

Hello @poovithaselvaraj ,

Gson is already there in Uber Jar. That's why you don't find it in the unit test. 
You need to put the dependency just before the uber jar in core pom.xml

<dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <scope>test</scope> </dependency>

 

 

1 reply

Sady_Rifat
Community Advisor
Sady_RifatCommunity AdvisorAccepted solution
Community Advisor
August 3, 2023

Hello @poovithaselvaraj ,

Gson is already there in Uber Jar. That's why you don't find it in the unit test. 
You need to put the dependency just before the uber jar in core pom.xml

<dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <scope>test</scope> </dependency>

 

 

Level 3
August 3, 2023

Thanks @sady_rifat , it works 🙂 Have a great day 🙂