Expand my Community achievements bar.

SOLVED

bundle failing to start

Avatar

Level 2

 

I’m getting this error when deploying my AEM core bundle:

Unable to resolve com.decor.core: missing requirement osgi.wiring.package=com.fasterxml.jackson.databind

My pom.xml includes:

<dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.13.5</version> </dependency> 

The bundle builds fine but stays in Installed state in AEM.
I tried <Embed-Dependency>jackson-databind</Embed-Dependency> — still same issue.

How can I properly resolve this?
Should Jackson be embedded, or is it already provided by AEM SDK?
We are on AEM as a Cloud Service SDK 2024.8.17821

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Vishal_Kagde,

IMO this issue isn’t about your Maven build - it’s about OSGi classloading in AEM.
com.fasterxml.jackson.databind isn’t exported by default in newer AEM SDKs, so your bundle can compile but still fail at runtime.

Try this approach

  1. Mark Jackson as provided (so it compiles but doesn’t embed conflicting versions):

    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.13.5</version>
      <scope>provided</scope>
    </dependency>

    This works if AEM already provides a compatible Jackson version (check /system/console/depfinder)

  2. If not found there, embed it manually just to validate and let the bundle export it:

    <Embed-Dependency>jackson-databind;inline=true</Embed-Dependency>
    <Export-Package>com.fasterxml.jackson.*</Export-Package>

    But only do this if no other bundles depend on AEM’s internal Jackson - otherwise you’ll hit classloader conflicts.


Santosh Sai

AEM BlogsLinkedIn


View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @Vishal_Kagde,

IMO this issue isn’t about your Maven build - it’s about OSGi classloading in AEM.
com.fasterxml.jackson.databind isn’t exported by default in newer AEM SDKs, so your bundle can compile but still fail at runtime.

Try this approach

  1. Mark Jackson as provided (so it compiles but doesn’t embed conflicting versions):

    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.13.5</version>
      <scope>provided</scope>
    </dependency>

    This works if AEM already provides a compatible Jackson version (check /system/console/depfinder)

  2. If not found there, embed it manually just to validate and let the bundle export it:

    <Embed-Dependency>jackson-databind;inline=true</Embed-Dependency>
    <Export-Package>com.fasterxml.jackson.*</Export-Package>

    But only do this if no other bundles depend on AEM’s internal Jackson - otherwise you’ll hit classloader conflicts.


Santosh Sai

AEM BlogsLinkedIn


Avatar

Employee

Hello @Vishal_Kagde 

Please refer to below Documentation - if a package isn't provided by the default SDK runtime and API region, you must provide it :

https://experienceleague.adobe.com/en/docs/experience-manager-learn/foundation/development/install-t...

- If you need Jackson for your bundle, you are expected to embed it
- Use the maven-bundle-plugin (or bnd-maven-plugin) to embed non-OSGi dependencies.
- Ensure the relevant Jackson packages (com.fasterxml.jackson.databind, etc.) are included as bundles and exported to your OSGi runtime.
- If you use <Embed-Dependency>jackson-databind</Embed-Dependency>, ensure it really embeds (includes) the jar in your bundle, and not just as a regular dependency.


Sample core bundle's pom.xml :

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.5</version>
</dependency>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
...
<configuration>
<instructions>
<Embed-Dependency>jackson-databind;scope=compile|runtime</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Import-Package>
com.fasterxml.jackson.databind*;resolution:=optional,
*
</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>