Retrofit Integration with AEM Cloud | Community
Skip to main content
September 2, 2024
Solved

Retrofit Integration with AEM Cloud

  • September 2, 2024
  • 2 replies
  • 1284 views

Hi,

I am facing issue while using retrofit2 in my aem project.

I have added all the dependency and bundles as well.

Getting error in new OkHttpClient.Builder().

Error Message : noclassdeffounderror kotlin/jvm/internal/intrinsics

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 arunpatidar

Hi @samikshas963487 
Please check, if you have retrofit2 osgi bundle installed and active, if not then try below:

2 replies

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
September 2, 2024

Hi @samikshas963487 
Please check, if you have retrofit2 osgi bundle installed and active, if not then try below:

Arun Patidar
Shiv_Prakash_Patel
Community Advisor
Community Advisor
September 2, 2024

Hi @samikshas963487 , Please follow the steps suggested by @arunpatidar , Along with that you can also check on below points.

You’re encountering a NoClassDefFoundError related to Kotlin dependencies. This error typically occurs when the Kotlin standard library is not included in your project. 

  • Add Kotlin Standard Library Dependency in pom.xml.<dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-stdlib</artifactId> <version>1.8.0</version> </dependency>
  • Embed Kotlin Library in Your OSGi Bundle by configuring maven-bundle-plugin in pom.xml.<build> <plugins> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>4.2.1</version> <extensions>true</extensions> <configuration> <instructions> <Embed-Dependency>kotlin-stdlib</Embed-Dependency> <Embed-Transitive>true</Embed-Transitive> </instructions> </configuration> </plugin> </plugins> </build>
  • Ensure All Necessary Dependencies Are Included in pom.xml.<dependency> <groupId>com.squareup.retrofit2</groupId> <artifactId>retrofit</artifactId> <version>2.9.0</version> </dependency> <dependency> <groupId>com.squareup.retrofit2</groupId> <artifactId>converter-gson</artifactId> <version>2.9.0</version> </dependency> <dependency> <groupId>com.squareup.okhttp3</groupId> <artifactId>okhttp</artifactId> <version>4.9.0</version> </dependency> <dependency> <groupId>com.squareup.okhttp3</groupId> <artifactId>logging-interceptor</artifactId> <version>4.9.0</version> </dependency>

Hope this will help you !

Regards,

Shiv Prakash