Hi, this is more a question for the Sling Users Mailing list (if at all), but 
let me give you some pointers.
Your manifest is not correct because it will only export the package 
'com.itextpdf' but not any sub packages (your class is in package  
com.itextpdf.text).
Also I would rather use the maven-bundle-plugin for that 
(http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html#embedding-dependencies
 
<http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html#embedding-dependencies>)
 which generates most parts of the manifest automatically for you.

Konrad

> On 24 Aug 2016, at 22:10, JCR <[email protected]> wrote:
> 
> Hello,
> 
> I've been scratching my head for days now...
> 
> I packaged the itext 5 library (to create PDFs) into a bundle by adding a 
> respective manifest, as documented here: 
> https://helpx.adobe.com/experience-manager/kb/ConvertAJarIntoOsgiBundle.html
> 
> While CRXDE has no problem in resolving the jar's classes and compiles 
> nicely, Sling or better, Felix, is unable to resolve the classes, like:
> 
> An error occurred at line: 14 in the jsp file: /apps/rome/comp/pdf/html.jsp
> Document cannot be resolved to a type
> 11: //print hello world with itext
> 12:   response.setContentType("application/pdf");
> 13:   try {
> 14:     Document doc = new Document();
> 15:     PdfWriter.getInstance(doc, response.getOutputStream());
> ...
> 
> The manifest looks like this:
> 
> Manifest-Version: 1.0
> Created-By: myself
> Bundle-ManifestVersion: 2
> Bundle-Name: itext5
> Bundle-Description: itext5 jar in an OSGi bundle
> Bundle-Version: 1.0.6
> Bundle-SymbolicName: com.itextpdf
> Bundle-ClassPath: .,iText5.0.4.jar
> Export-Package: com.itextpdf
> Import-Package: com.itextpdf
> 
> 
> The class is in jar:
>  com/itextpdf/text/Document.class
> 
> 
> The bundle starts and is active. From Felix console:
> 
> itext5com.itextpdf
> Symbolischer Name     com.itextpdf
> Version       1.0.6
> Bundle Location       inputstream:itext504-bundle-classes.jar
> Letzte Bundle Status Änderung Wed Aug 24 21:19:06 CEST 2016
> Beschreibung  itext5 jar in an OSGi bundle
> Start Level   20
> Bundle Classpath      .,iText5.0.4.jar
> Exportierte Packages  com.itextpdf,version=0.0.0
> Importierte Packages  None
> Manifest Headers      Bundle-ClassPath: ., iText5.0.4.jar
> Bundle-Description: itext5 jar in an OSGi bundle
> Bundle-ManifestVersion: 2
> Bundle-Name: itext5
> Bundle-SymbolicName: com.itextpdf
> Bundle-Version: 1.0.6
> Created-By: myself
> Export-Package: com.itextpdf
> Manifest-Version: 1.0
> 
> 
> I tried quite a few modifications with the manifest, and also added the 
> bundle via the Felix console directly, but absolutely no change, no success.
> 
> 
> Any hints?
> 
> Thanks,
> Juerg

Reply via email to