Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

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

Avatar

Level 4

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>

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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>

 

 

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

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>