0

Am importing the itext pdf related maven pom dependencies, my build is successful but the Felix console says the below error which causes the bundle to be in INSTALLED status instead of ACTIVE.

com.itextpdf.text -- Cannot be resolved

com.itextpdf.text.pdf -- Cannot be resolved

Is there any specific change i have to do in the maven?

ERROR IN FELIX BUNDLE

VAr
  • 2,551
  • 1
  • 27
  • 40
  • Can you share your maven dependency element. Are you assuming provided or compiling it? – Imran Saeed Jan 10 '17 at 15:44
  • Here is the one i have added it in my pom.xml, and i have compiled it by "mvn clean install" which results in success built of the bundle, but after deploying into the AEM Felix container it shows the above mentioned error. ` com.itextpdf itextpdf 5.5.8 ` – VAr Jan 11 '17 at 16:28
  • @VAr plz accept my answer if it solved your problem :) – mickleroy Jan 12 '17 at 03:37

2 Answers2

1

Apache Felix cannot resolve those dependencies because it is missing the required meta data for iText. You need to use a version of iText PDF that is an OSGI bundle instead of a normal JAR in order for those dependencies to be resolved.

If the iText developers do not provide an OSGI version of the library, you will have to convert it yourself. This development article or this one have instructions on how to convert a simple JAR into an OSGI bundle to be used in AEM.

What you can also do (if you do not care about having iText as an independent module in your OSGI container) is to embed the jar in your CRX package.

In your content-package pom.xml:

<plugin>
    <groupId>com.day.jcr.vault</groupId>
    <artifactId>content-package-maven-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
        <group>Acme</group>
        <filterSource>src/main/content/META-INF/vault/filter.xml</filterSource>
        <embeddeds>
            <embedded>
                <groupId>com.acme</groupId>
                <artifactId>aem.core</artifactId>
                <target>/apps/acme/install</target>
            </embedded>
            <embedded>
                <groupId>com.itextpdf</groupId>
                <artifactId>itextpdf</artifactId>
                <target>/apps/acme/install</target>
            </embedded>
        </embeddeds>
    </configuration>
</plugin>

mickleroy
  • 998
  • 5
  • 8
0

Thanks All, I have resolved it by adding com.itextpdf.* in <Export-package> tag. which solved my issue.

Note: I have to add other unresolved dependencies also in the Export and Import tags.

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
    <Bundle-SymbolicName>my-group-id.myexampleproj-bundle</Bundle-SymbolicName> <Export-Package>com.itextpdf.*,org.bouncycastle.*,org.apache.xml.security.*,org.apache.jcp.xml.dsig.*,org.apache.xml.*,org.apache.log.*,org.apache.jcp.*,org.apache.avalon.*,org.apache.xerces.*,org.apache.xpath.*,org.apache.xalan.*,org.apache.jcp.xml.dsig.internal.dom,org.apache.bcel.*,org.apache.xml.resolver.*,org.apache.regexp,java_cup.runtime</Export-Package>
    <Import-Package>
    sun.security.util;resolution:=optional,
    sun.io;resolution:=optional,
    *
    </Import-Package>
</instructions>
</configuration>

Felix Bundlde Active

VAr
  • 2,551
  • 1
  • 27
  • 40