Views
Replies
Total Likes
hi @BhanuMa,
I've a few questions:
<scope>test</scope>
to the dependency and remove the embed, though.
From your Sonar message, the embedded jar version is 1.4.6, but your dependency declares 2.0.0. This discrepancy should be addressed. Have you noticed it?
Hi @giuseppebag ,
Sorry its typo mistake, we are using 1.4.6 in pom.xml also. Just we were thinking if we upgrade the version does it resolve the sonar issues or not.
Views
Replies
Total Likes
IMHO, the best solution is to address the root cause by avoiding the embedding of the jar, if possible. As a last resort, you could instruct SonarQube to exclude embedded jars or generated classes from the analysis to suppress false positives.
If i remove the embed property the jar won't be available. Because of missing this dependency only we added the embedd property.
Views
Replies
Total Likes
HI @BhanuMa ,
The version specified for org.apache.sling.servlet-helpers
in your pom.xml
is 2.0.0.
However, another dependency in your project is also referencing org.apache.sling.servlet-helpers
version 1.4.6.
This is causing a dependency conflict, which may have been introduced during the AEM upgrade or could be coming from the uber jar.
One possible solution is to align the versions by explicitly setting org.apache.sling.servlet-helpers
to 1.4.6 in your pom.xml
.
-Tarun
Hi @TarunKumar ,
Sorry for typo mistake, we were using 1.4.6. Its present in all the places.
Thanks,
Bhanu M.
Views
Replies
Total Likes
@BhanuMa Hey! Just wanted to see if this got resolved. If you solved it yourself, sharing your solution could really help others. And if one of the answers here helped you, marking it as accepted will guide future readers. Thanks!
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi @BhanuMa,
In AEM 6.5 (AMS), the org.apache.sling. The servlet-helpers bundle is not shipped out of the box. That’s why you don’t see it under System Console → Bundles.
In AEM as a Cloud Service, the bundle is included as part of the base SDK dependencies, so your code works there without embedding.
By embedding the JAR manually under /apps/.../install, Sonar is flagging issues because you’re bringing in classes that implement Sling’s @ProviderType interfaces (e.g.,). RequestParameterRequestParameterMap Those are not supposed to be implemented directly by application code.
Best fix (short term): Install the org.apache.sling.servlet-helpers bundle into AEM 6.5 via OSGi console instead of embedding.
Best fix (long term): Refactor away from SlingInternalRequest usage. Use either:
Standard RequestDispatcher/Sling API for intra-request handling, or
Adobe Target’s official integration APIs for XF sync.
This will:
✔ Remove Sonar issues (no provider-type violation).
✔ Keep your code portable between AEM 6.5 and AEMaaCS.
✔ Avoid future upgrade/maintenance headaches.
Actionable next step:
Try removing the embed from yours. pom.xml
Install the org.apache.sling.servlet-helpers bundle via the OSGi console on 6.5.21.
Confirm if the servlet-based Target sync works. If yes, proceed to refactor toward Target APIs for long-term stability.
------------------------------------------------------------------------------------------------------------------------------------------------
Do not embed the JAR
Embedding OSGi bundles under /apps/.../install is not recommended—it can create version conflicts and Sonar issues (as you’ve seen).
Instead, install the required bundle as an OSGi dependency in AEM:
You can download the matching version, org.apache.sling.servlet-helpers, from the Apache Sling Maven Repo.
Then upload it via AEM Console → Bundles → Install/Update.
This avoids embedding and clears Sonar concerns, since the code won’t be packaged inside your project anymore.
Upgrade to a supported AEM Service Pack
You mentioned you’re on 6.5.21.
Check the release notes—in some recent service packs, Adobe backported certain Sling bundles.
Upgrading to the latest 6.5 SP could include the missing dependency without needing a workaround.
Alternative approach for Target sync
If the goal is to sync Experience Fragments to Target, you may not actually need SlingInternalRequest or servlet-helpers.
Adobe provides the Target Integration via IMS + Target API, which allows XF export. This can be done with a proper HTTP client (e.g., org.apache.http.client) instead of simulating a POST via SlingInternalRequest.
That way, you avoid dependency on org.apache.sling.servlet-helpers altogether.
Views
Replies
Total Likes
Views
Like
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies