0
votes

I have got the project for migration. Currently, version is CQ5.6. Maven build is deploying successfully. However, after build, bundles in osgi show in installed state. Two dependencies causing the issue.

org.apache.felix.shell,version=[1.0,2) -- Cannot be resolved

I was getting an error earlier as below during build.

ERROR

[INFO] --- maven-bundle-plugin:2.3.4:bundle (default-bundle) @ myPRJ-taglib ---
[ERROR] Error building bundle com.mypack.deewealth:myPRJ-taglib:bundle:1.0.0-SNAPSHOT : Unresolved references to [org.apache.felix.shell] by class
(es) on the Bundle-Classpath[Jar:dot, Jar:OSGI-INF/lib/recaptcha4j-0.0.8-kohsuke-1.jar, Jar:OSGI-INF/lib/commons-io-2.1.jar, Jar:OSGI-INF/lib/commons-
lang-2.4.jar, Jar:OSGI-INF/lib/crx-packagemgr-1.0.22.jar, Jar:OSGI-INF/lib/squeakysand-osgi-0.4.0.jar, Jar:OSGI-INF/lib/jsoup-1.6.1.jar, Jar:OSGI-INF/
lib/stax-api-1.0-2.jar, Jar:OSGI-INF/lib/org.apache.sling.settings-1.1.0.jar, Jar:OSGI-INF/lib/cq-compat-runmode-0.2.0.jar, Jar:OSGI-INF/lib/commons-c
ollections-3.2.1.jar, Jar:OSGI-INF/lib/squeakysand-jsp-0.4.0.jar, Jar:OSGI-INF/lib/squeakysand-commons-0.4.0.jar]: [org/apache/sling/settings/impl/Run
ModeCommand.class]

To solve this I added below dependancy in pom.xml, as we added in Dependency

<dependency>
    <groupId>org.apache.felix</groupId>
    <artifactId>org.apache.felix.shell</artifactId>
    <version>1.4.2</version>
    <scope>provided</scope>
</dependency>

Under import statement.

<Import-Package>
    ....
    ....
   org.apache.felix.shell
 </Import-Package>

After that, build was successful, but bundle was in resolved state because of

org.apache.felix.shell,version=[1.0,2) -- Cannot be resolved

Any suggestion, why this is causing the problem.

3

3 Answers

2
votes

org.apache.felix.shell,version=[1.0,2) -- Cannot be resolved mean that you are trying to use these felix packages from within AEM. However - there are no OSGi bundles in AEM that exports these packages.
You can download the bundle from maven repo and upload it into the AEM Felix console and use it.

OR you can create it as your parent pom dependency as one of module and wrap along with your project jar and use it.

AEM Felix

To veify the availability of any package and dependencies use AEM Dependency finder.

AEM Dependency Finder

2
votes

I don't know CQ but I can explain why this happens in general. You had the error during build time because of missing dependency. You correctly solved it by adding the dependency which fixed your build. What happened behind the scenes is your bundle was updated with information that it needs (imports) org.apache.felix.shell,version=[1.0,2) package and that package will be provided by some other bundle at runtime.

Then at runtime the resolver got that information and tried to find a bundle that provides (exports) org.apache.felix.shell,version=[1.0,2) package. It couldn't find one and so the resolution failed and your bundle was left in installed (I believe that's what you meant to write instaed of resolved in your last sentence) state!

To solve that, you need to make sure org.apache.felix.shell,version=[1.0,2) package is available at runtime. I don't know CQ and how to install bundles in it but since you can install your own bundle I assume you can also install org.apache.felix.shell bundle the same way.

0
votes

The shell jar you have installed is still unresolved as it depends on some jars that might not be present. You need to find the depth of all dependencies and resolve them.