Getting Java.lang.NoSuchMethodError with 6.5.17 Uber jar | Community
Skip to main content
shabarish
Level 2
June 14, 2023
Solved

Getting Java.lang.NoSuchMethodError with 6.5.17 Uber jar

  • June 14, 2023
  • 2 replies
  • 2662 views

Hi all,

 

I am trying build my project with new Uber jar 6.5.17.

I am getting

Java.lang.NoSuchMethodError: com.google.gson.internal.bind.ObjectaTyperAdapter.getFactory.

In the testing phase.

We have added the Gson(2.8.5)  dependency to the core POM file but still getting same error.

It was working file with 6.5.10 Uber jar.

Anyone knows how to fix it

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

Make sure you added the Gson dependency before the Uber Jar. At least in the core pom.xml

<dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.adobe.aem</groupId> <artifactId>uber-jar</artifactId> </dependency>

 

 

2 replies

Sady_Rifat
Community Advisor
Sady_RifatCommunity AdvisorAccepted solution
Community Advisor
June 14, 2023

Make sure you added the Gson dependency before the Uber Jar. At least in the core pom.xml

<dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.adobe.aem</groupId> <artifactId>uber-jar</artifactId> </dependency>

 

 

shabarish
shabarishAuthor
Level 2
June 14, 2023

It resolved my issue.

Just for learning why we need to add Gson dependency before Uber?

Sady_Rifat
Community Advisor
Community Advisor
June 14, 2023

Gson is also present in Uber Jar. But this gson is not scoped for unit tests(may be). When you add extra maven dependency for the unit test it needs to place before Uber Jar. Because you want to initialize the Gson from the Gson maven dependency for classpath priority.

January 2, 2024

I faced the same issue, but in my case the dependency was org.apache.poi and after coming across your issue-answer, I was able to fix it.

Thanks so much @sady_rifat for the answer.