Integrating Azure Messaging Servicebus with AEM
I am currently working on integrating Azure Service Bus with AEM and need to load the azure-messaging-servicebus dependencies in the AEM environment to enable file POST operations via a servlet to the Azure endpoint.
I have downloaded the required JAR — azure-messaging-servicebus-7.17.16 — along with its relevant dependencies.
These JAR files have been placed in a lib folder located at the root of the codebase, and I have updated the core/pom.xml accordingly as shown below (Added Azure and Netty dependencies and updated the bnd-maven-plugin configuration with corresponding Import-Package and Embed-Dependency directives) :

<?xml version="1.0" encoding="UTF-8"?>
<!--
| Copyright 2017 Adobe Systems Incorporated
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.adobe.aem</groupId>
<artifactId>common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>common.core</artifactId>
<name>Common - Core</name>
<description>Core bundle for Common</description>
<build>
<plugins>
<!-- Sling plugin for bundle build -->
<plugin>
<groupId>org.apache.sling</groupId>
<artifactId>sling-maven-plugin</artifactId>
</plugin>
<!-- Maven Bundle Plugin: Handles OSGi manifest and embedding -->
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<executions>
<execution>
<id>bnd-process</id>
<goals>
<goal>bnd-process</goal>
</goals>
<configuration>
<bnd><![CDATA[
Import-Package: \
!com.azure.*, \
!reactor.*, \
!io.netty.*, \
!org.apache.qpid.*, \
!org.reactivestreams.*, \
!io.projectreactor.*, \
com.adobe.guides.core.exception;resolution:=optional, \
com.adobe.guides.utils.dto;resolution:=optional, \
com.adobe.guides.utils.utilities.service;resolution:=optional, \
com.adobe.fmdita.uuid;resolution:=optional, \
com.adobe.fmdita.uuid.concrete;resolution:=optional, \
javax.annotation;version=0.0.0, \
javax.crypto.*, \
javax.net.ssl.*, \
org.slf4j.*;version="[1.7,2)", \
*
-fixupmessages: "Classes found in the wrong directory"; restrict:=error; is:=warning
Embed-Dependency: \
*;scope=system;inline=true;groupId=com.azure|io.netty|io.projectreactor|org.reactivestreams|org.apache.qpid|com.microsoft.azure
Export-Package: \
com.adobe.aem.common.core.*;version=${project.version}
Private-Package: \
com.adobe.aem.common.core.*
]]></bnd>
</configuration>
</execution>
</executions>
</plugin>
<!-- Baseline check plugin -->
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-baseline-maven-plugin</artifactId>
<configuration>
<failOnMissing>false</failOnMissing>
</configuration>
<executions>
<execution>
<id>baseline</id>
<goals>
<goal>baseline</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Unit test execution -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<!-- JAR packaging -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>uk.org.lidalia</groupId>
<artifactId>slf4j-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>aem-sdk-api</artifactId>
</dependency>
<dependency>
<groupId>com.adobe.cq</groupId>
<artifactId>core.wcm.components.core</artifactId>
<scope>test</scope>
</dependency>
<!-- Adobe CIF Dependencies -->
<dependency>
<groupId>com.adobe.commerce.cif</groupId>
<artifactId>core-cif-components-core</artifactId>
</dependency>
<dependency>
<groupId>com.adobe.commerce.cif</groupId>
<artifactId>magento-graphql</artifactId>
</dependency>
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>aem-cif-sdk-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Testing -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.testing.aem-mock.junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.caconfig-mock-plugin</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.adobe.cq</groupId>
<artifactId>core.wcm.components.testing.aem-mock-plugin</artifactId>
<scope>test</scope>
</dependency>
<!-- Required to be able to support injection with @Self and @2434638 -->
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.models.impl</artifactId>
<version>1.4.14</version>
<scope>test</scope>
</dependency>
<!-- Sling Distribution API -->
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.distribution.api</artifactId>
<version>0.3.0</version>
<scope>provided</scope>
</dependency>
<!-- Sling Distribution Core (common + impl classes like DistributionRequest, DistributionException) -->
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.distribution.core</artifactId>
<version>0.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
</dependency>
<!-- AZURE DEPENDENCIES -->
<!-- Azure Service Bus and dependencies as system scope -->
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-messaging-servicebus</artifactId>
<version>7.17.4</version>
<scope>system</scope>
<systemPath>${project.basedir}/../lib/azure-messaging-servicebus-7.17.4.jar</systemPath>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.57.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/../lib/azure-core-1.57.0.jar</systemPath>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-amqp</artifactId>
<version>2.11.2</version>
<scope>system</scope>
<systemPath>${project.basedir}/../lib/azure-core-amqp-2.11.2.jar</systemPath>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
<version>1.16.2</version>
<scope>system</scope>
<systemPath>${project.basedir}/../lib/azure-core-http-netty-1.16.2.jar</systemPath>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-json</artifactId>
<version>1.5.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/../lib/azure-json-1.5.0.jar</systemPath>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-xml</artifactId>
<version>1.2.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/../lib/azure-xml-1.2.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
<version>1.0.4</version>
<scope>system</scope>
<systemPath>${project.basedir}/../lib/reactive-streams-1.0.4.jar</systemPath>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>3.4.34</version>
<scope>system</scope>
<systemPath>${project.basedir}/../lib/reactor-core-3.4.34.jar</systemPath>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>qpid-proton-j-extensions</artifactId>
<version>1.2.7</version>
<scope>system</scope>
<systemPath>${project.basedir}/../lib/qpid-proton-j-extensions-1.2.7.jar</systemPath>
</dependency>
<dependency>
<groupId>org.apache.qpid</groupId>
<artifactId>proton-j</artifactId>
<version>0.34.1</version>
<!-- {x-version-update;org.apache.qpid:proton-j;external_dependency} -->
</dependency>
<!-- Netty DEPENDENCIES -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>4.1.127.Final</version>
<!-- {x-version-update;io.netty:netty-handler;external_dependency} -->
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler-proxy</artifactId>
<version>4.1.127.Final</version>
<!-- {x-version-update;io.netty:netty-handler-proxy;external_dependency} -->
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.127.Final</version>
<!-- {x-version-update;io.netty:netty-buffer;external_dependency} -->
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId>
<version>4.1.127.Final</version>
<!-- {x-version-update;io.netty:netty-codec;external_dependency} -->
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http</artifactId>
<version>4.1.127.Final</version>
<!-- {x-version-update;io.netty:netty-codec-http;external_dependency} -->
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http2</artifactId>
<version>4.1.127.Final</version>
<!-- {x-version-update;io.netty:netty-codec-http2;external_dependency} -->
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-unix-common</artifactId>
<version>4.1.127.Final</version>
<!-- {x-version-update;io.netty:netty-transport-native-unix-common;external_dependency} -->
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>4.1.127.Final</version>
<!-- {x-version-update;io.netty:netty-transport-native-epoll;external_dependency} -->
<classifier>linux-x86_64</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<version>4.1.127.Final</version>
<!-- {x-version-update;io.netty:netty-transport-native-kqueue;external_dependency} -->
<classifier>osx-x86_64</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>2.0.74.Final</version>
<!-- {x-version-update;io.netty:netty-tcnative-boringssl-static;external_dependency} -->
<classifier>${boring-ssl-classifier}</classifier>
</dependency>
<dependency>
<groupId>io.projectreactor.netty</groupId>
<artifactId>reactor-netty-http</artifactId>
<version>1.2.10</version>
<!-- {x-version-update;io.projectreactor.netty:reactor-netty-http;external_dependency} -->
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-common</artifactId>
<version>4.1.127.Final</version>
<!-- {x-version-update;io.netty:netty-common;external_dependency} -->
</dependency>
</dependencies>
</project>
Even though the project builds successfully, the AEM core bundle fails to load the Azure dependencies during deployment. It seems that the Azure-related JARs are not being embedded or resolved properly within the bundle. I’d like to understand what’s missing or incorrectly configured in this setup.
