I'm facing an issue with my OSGi bundle, which remains in the Installed state after adding Apache PDFBox dependencies to my bnd-baseline-maven-plugin. Here's my setup:
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.9</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>fontbox</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.61</version>
</dependency>
bnd Configuration:
<bnd><![CDATA[
Import-Package: javax.annotation,*,!org.bouncycastle.*
-exportcontents: ${packages;VERSIONED}
-conditionalpackage: org.apache.pdfbox.*,org.apache.fontbox.*,org.bouncycastle.*
Bundle-DocURL:
-plugin org.apache.sling.caconfig.bndplugin.ConfigurationClassScannerPlugin
]]></bnd>
After installing the bundle, I receive the following error:
sun.java2d.cmm.kcms -- Cannot be resolved and overwritten by Boot Delegation
Additionally, I see the following messages in the bundle:
Views
Replies
Total Likes
Hi @georhe6
You could first check you Sling configs, maybe you have something in the bootdelegation property that leads to these errors.
Please rewd this documentation, maybe it helps https://sling.apache.org/documentation/configuration.html#osgi-boot-delegation-support-1
Views
Replies
Total Likes
Thanks @Tethich , for the feedback.
I did not make any changes at Sling configs level ,after adding these dependencies I am getting the error.
Views
Replies
Total Likes
@georhe6 The "Installed" state typically means the bundle could not resolve dependencies. Ensure all the transitive dependencies are resolved and versions are aligned as per the dependency related doc.
- Maybe try updating java to higher versions.
- Try updating pdfbox versions to the latest one.(supporting to current java/JVM)
- Maybe try adding this to the config.properties file:
org.osgi.framework.bootdelegation=sun.java2d.cmm.kcms
- Or you could try Modifying the Bundle's Import-Package Directive to something like- Import-Package: sun.java2d.cmm.kcms;resolution:=optional
Views
Replies
Total Likes
Thanks @Manu_Mathew_ ,
We are using java 11 , I have tried with latest versions of pdfbox .
Can you please review the bnd config please.
Both pdfbox and felix are inside org.apache ,I assume some dependency conflict
Views
Replies
Total Likes
Hi @georhe6 - Here's a thread from our community https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/can-we-use-pdf-library-wit... on similar issue. Seems like a lower version of the pdfbox works in some cases, and an alternate option of itextpdf has also been discussed.
Regards,
Views
Replies
Total Likes
Thanks @Fanindra_Surat , Thanks
Similar issues I am facing with Itextpdf also,
Can you suggest any version which i can try
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies