How to fix package Cannot be resolved issue in OSGI?

76 views Asked by At

I am creating OSGI bundle for Flying Saucer(https://github.com/flyingsaucerproject/flyingsaucer) module but is failing due to com.apple.mrj -- Cannot be resolved in Imported Packages section.

Below is the dependency I am trying to add,

<dependency>
    <groupId>org.xhtmlrenderer</groupId>
    <artifactId>flying-saucer-pdf-itext5</artifactId>
    <version>9.0.1</version>
    <scope>provided</scope>
</dependency>

Since dependency have dependency with others so I am adding below dependencies

<dependency>
    <groupId>org.xhtmlrenderer</groupId>
    <artifactId>flying-saucer-pdf</artifactId>
    <version>9.2.2</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>com.lowagie</groupId>
    <artifactId>itext</artifactId>
    <version>2.1.7</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>com.apple</groupId>
    <artifactId>AppleJavaExtensions</artifactId>
    <version>1.4</version>
    <scope>provided</scope>
</dependency>

I get below error while activaging this bundle,

25.09.2023 19:20:05.329 *ERROR* [qtp1339983583-2215] org.apache.felix.http.jetty Bundles: Cannot start (org.osgi.framework.BundleException: Unable to resolve com.adobe [689](R 689.1): missing requirement [com.adobe [689](R 689.1)] osgi.wiring.package; (osgi.wiring.package=com.apple.mrj) Unresolved requirements: [[com.adobe [689](R 689.1)] osgi.wiring.package; (osgi.wiring.package=com.apple.mrj)])
org.osgi.framework.BundleException: Unable to resolve com.adobe [689](R 689.1): missing requirement [com.adobe [689](R 689.1)] osgi.wiring.package; (osgi.wiring.package=com.apple.mrj) Unresolved requirements: [[com.adobe [689](R 689.1)] osgi.wiring.package; (osgi.wiring.package=com.apple.mrj)]

Looks like it could not import "com.apple.mrj -- Cannot be resolved" and com.lowagie.toolbox -- Cannot be resolved

Below in my bnd-maven-plugin. Here I am importing and exporting all packages using *

<configuration>
                            <bnd><![CDATA[
Bundle-Category: VeevaCoreCommon
Bundle-SymbolicName: com.adobe
Import-Package: javax.annotation;version=0.0.0,\
                !sun.*,!*.internal.*,\
                !junit.*,!com.aayushatharva.*,!com.github.*,\
                !com.googl.*,!com.jcraft.*,!com.ning.*,\
                !com.oracle.*,!kotlin,!lzma.*,!net.jpountz.*,\
                !org.apache.avalon.*,!org.apache.log,!org.bouncycastle.*,\
                !org.apache.logging.*,!reactor.*,\
                !org.conscrypt,!org.eclipse.*,!org.jboss.*,!scala.util,\
                !com.google.protobuf.*,*
Export-Package:  !sun.*,\
                 !junit.*,*

          ]]></bnd>
</configuration>

enter image description here

I added the dependency for the package com.lowagie.toolbox & com.apple.mrj. Can anyone tell me how to fix this issue ? Actually I want to import below in my java class

import org.xhtmlrenderer.pdf.ITextRenderer;

So I am trying to add all dependencies. How do I ensure I am adding all inter dependencies correctly ? is there any way ? Why this import is not resolving even after adding it's dependency? Any idea/input would be really helpful.

0

There are 0 answers