Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Use 3rd party API or JAR or Dependency in AEM | AEM Community Blog Seeding

Avatar

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,164 likes

Total Posts

6,273 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,164 likes

Total Posts

6,273 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile
kautuk_sahni
Community Manager

14-02-2021

BlogImage.jpg

Use 3rd party API or JAR or Dependency in AEM by Rahul Aggarwal

Abstract

A 3rd party jar is one which is not present as a bundle in AEM OSgI. If you want to use API’s from a 3rd party jar in AEM then it needs to be added to AEM OSGI.

If you try to upload a 3rd party jar in osgi then it won’t, get uploaded. To upload it in osgi it needs to be osgi specific with MANIFEST.MF file. OSGI bundle is nothing but jar with MANIFEST.mf file.

Lets take the example of apollo client which is not available in aem osgi. Apolloclient can be used to make graphql requests using graphql query.


Problem statement:
Example: If you are using Apolloclient API for sending graphql requests in backend. Then you probably already included the dependencies in POM to resolve the API’s. If you do a maven build it will build successfully and deploy to AEM. However, if you check in OSGI the core bundle will NOT be in active state. If you dig deeper the apolloclient dependencies are not resolved in the bundle. Reason for this is apolloclient is not available in AEM runtime. You will probably also get internal server error if you try to access any of the site pages.


Solution:
All jars required for the apollo client to work in aem osgi, should be embedded in core bundle and available in its classpath. All transitive dependencies of apolloclient need to be added as well. This way we are adding all the jars to bundle classpath and these jars wont be available as separate bundles in osgi.

Add all jars to include-resource of bnd maven plugin in core pom. All these jars need to be added to classpath of the plugin.

Read Full Blog

Use 3rd party API or JAR or Dependency in AEM

Q&A

Please use this thread to ask the related questions.

AEM AEMEBlogSeeding Experience Manager