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
Level 1
nickt95164926
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile

Avatar
Level 1
nickt95164926
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile
nickt95164926
Level 1

05-09-2019

The code compiles successfully with Maven. The issues arise when the bundle is activated in Felix.

When I look at the contents of the bundle zip file, some of those dependencies: org.jaxen and org.jdom are not present and with the full maven output using -X I see no errors or warnings about them.

However, for some reason, when running in Felix these dependencies are required and cannot be resolved.