Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Missing OSGI Dependencies

Avatar

Avatar
Validate 1
Level 1
nickt39971962
Level 1

Likes

2 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
nickt39971962
Level 1

Likes

2 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
nickt39971962
Level 1

04-09-2019

When adding a new dependency in the POM file of an OSGI bundle (which is deployed inside an AEM package to CRX) I will often see a number of unresolved dependencies in the OSGI console. The bundle will fail to activate.

Example:

org.jaxen.dom -- Cannot be resolved

org.jaxen.dom4j -- Cannot be resolved

org.jaxen.jdom -- Cannot be resolved

org.jaxen.pattern -- Cannot be resolved

org.jaxen.saxpath -- Cannot be resolved

org.jdom -- Cannot be resolved

org.jdom.input -- Cannot be resolved

org.jdom.output -- Cannot be resolved

How can I debug this type of problem? How can I understand why those dependencies are required yet cannot be resolved?

I can see in the POM that the bundle has been configured as follows:

<plugin>

                <groupId>org.apache.felix</groupId>

                <artifactId>maven-bundle-plugin</artifactId>

                <configuration>

                    <instructions>

                        <Bundle-Activator>com.mycompany.aem.Activator</Bundle-Activator>

                        <Export-Package>

                            com.mycompany.aem.*

                        </Export-Package>

                        <Sling-Model-Packages>

                            com.mycompany.aem.components.page,

                            com.mycompany.aem.models,

                            com.mycompany.aem.helper

                        </Sling-Model-Packages>

                        <Include-Resource>{maven-resources}</Include-Resource>

                        <Embed-Dependency>*;scope=compile|runtime;inline=false</Embed-Dependency>

                        <Embed-Transitive>true</Embed-Transitive>

                        <Import-Package>

                            android.util.*;resolution:=optional,

                            javax.validation.*;resolution:=optional,

                            org.apache.axiom.*;resolution:=optional,

                            org.apache.cxf.*;resolution:=optional,

                            !com.sun.msv.*;resolution:=optional,

                            !com.sun.xml.bind.marshaller.*;resolution:=optional,

                            !com.sun.xml.fastinfoset.stax.*;resolution:=optional,

                            !net.sf.cglib.*;resolution:=optional,

                            !org.apache.aries.*;resolution:=optional,

                            org.apache.axiom.*;resolution:=optional,

                            org.apache.mina.*;resolution:=optional,

                            org.osgi.service.blueprint.*;resolution:=optional,

                            !org.relaxng.*;resolution:=optional,

                            !org.springframework.*;resolution:=optional,

                            !javax.resource.*;resolution:=optional,

                            !javax.xml.ws.spi.http.*;resolution:=optional,

                            !com.sun.*;resolution:=optional,

                            sun.*;resolution:=optional,

                            org.apache.*;resolution:=optional,

                            org.jvnet.*;resolution:=optional,

                            *

                        </Import-Package>

                    </instructions>

                </configuration>

            </plugin>

View Entire Topic

Avatar

Avatar
Give Back 5
Level 3
anujg3325839
Level 3

Likes

27 likes

Total Posts

26 posts

Correct Reply

8 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Boost 5
Boost 3
View profile

Avatar
Give Back 5
Level 3
anujg3325839
Level 3

Likes

27 likes

Total Posts

26 posts

Correct Reply

8 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Boost 5
Boost 3
View profile
anujg3325839
Level 3

04-09-2019

All these dependencies should already present if not shipped with the bundle jar/package. you can check the stdout log to see the details on why these dependencies are not resolved. in case these dependencies are part of some other bundle package, please ensure the other bundle should get started first, you can control it via start-up level of the bundle.