1
votes

When I try to deploy my bundle to OSGi via maven, this shows in installed state. My Project is multimodule, so having two bundles. What I saw in taglib bundle is :

org.apache.felix.shell from org.apache.felix.shell (292)
org.apache.jackrabbit.api,version=[2.3,3) from org.apache.jackrabbit.jackrabbit-api (65)
org.apache.jackrabbit.api.jsr283.security -- Cannot be resolved
org.apache.jackrabbit.api.security,version=[2.3,3) from org.apache.jackrabbit.jackrabbit-api (65)
org.apache.jackrabbit.api.security.principal,version=[2.3,3) from org.apache.jackrabbit.jackrabbit-api (65)
org.apache.jackrabbit.api.security.user,version=[2.3,3) from org.apache.jackrabbit.jackrabbit-api (65)

After checking the logs, I see below:

14.04.2017 17:23:03.330 *ERROR* [FelixDispatchQueue] com.abc.MyPrj-services FrameworkEvent ERROR (org.osgi.framework.BundleException: Unresolved constraint in bundle com.abc.MyPrj-services [290]: Unable to resolve 290.0: missing requirement [290.0] osgi.wiring.package; (osgi.wiring.package=org.apache.jackrabbit.api.jsr283.security)) org.osgi.framework.BundleException: Unresolved constraint in bundle com.abc.MyPrj-services [290]: Unable to resolve 290.0: missing requirement [290.0] osgi.wiring.package; (osgi.wiring.package=org.apache.jackrabbit.api.jsr283.security)
    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3896)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1938)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1261)
    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:298)
    at java.lang.Thread.run(Thread.java:745)

I have added below dependency in both modules taglib, services.

 <dependency>
            <groupId>org.apache.jackrabbit</groupId>
            <artifactId>jackrabbit-api</artifactId>
            <version>2.5.2</version>
            <scope>provided</scope>
        </dependency>

Below is the pom of taglib module:

<plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Export-Package>
                            com.mypkg.gwms.ra.tags.*;version=${project.version}
                        </Export-Package>
                        <Import-Package>
                            com.adobe.granite.*,
                            com.day.*,
                            javax.*,
                            org.apache.commons.*,
                            org.apache.sling.*,
                            org.apache.tika.*,
                            org.osgi.*,
                            org.w3c.dom.*,
                            org.xml.sax.*,
                            org.slf4j.*,
                            org.apache.felix.shell.*,
                            org.apache.jackrabbit.*,
                        </Import-Package>
                        <Include-Resource>
                            META-INF/${project.artifactId}-${project.version}.tld=${project.build.outputDirectory}/META-INF/${project.artifactId}-${project.version}.tld,
                            {maven-resources},
                            {maven-dependencies}
                        </Include-Resource>
                        <Sling-Bundle-Resources>
                            /META-INF/tags
                        </Sling-Bundle-Resources>
                    </instructions>
                </configuration>
            </plugin>

Thanks,

3
which version of aem? - awd
CQ5.6, and I Think that is because of that. I have the statement org.apache.jackrabbit.api.security.JackrabbitAccessControlList which was giving the compilation error. Therefore I added, jackrabbit api dependency. After that build was successful, But org.apache.jackrabbit.api.jsr283.security -- Cannot be resolved was not resolved. - Vivek Dhiman

3 Answers

1
votes

I was required to have 2 dependencies of the same API but with the different version. The latest one was using in services module. Other module taglib, was looking for the older version of the same dependency to resolve org.apache.jackrabbit.api.jsr283.security

To solve this, I added below statement in my pom.xml .

<Import-Package>
org.apache.jackrabbit.*;version=1.6.1 
</Import-Package>

Only import 1.6.1 version. That's worked.

0
votes

The error tells you that you also need to install a bundle that provides the package org.apache.jackrabbit.api.jsr283.security.

You can check in the Manifest of a bundle if it exports this package.

0
votes

You should install a bundle which contains org.apache.jackrabbit.api.jsr283.security package and exports it, to your osgi container.