Dom4j bundle || unable to resolve in OSGI

Avatar

Avatar
Validate 1
Level 1
SagarVerliani
Level 1

Likes

0 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
SagarVerliani
Level 1

Likes

0 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
SagarVerliani
Level 1

28-06-2021

Hi All,

 

We are trying to add org.dom4j maven dependency but the bundle is unable to resolve. (AEM version 6.5.6, jdk version - 1.8)

 

We have added below dependency
<dependency>
     <groupId>dom4j</groupId>
     <artifactId>dom4j</artifactId>
     <version>1.6.1</version>
     <scope>provided</scope>
     </dependency>

 

Also we have tried using,
<configuration>
<bnd><![CDATA[
                            <Embed-Dependency>dom4j</Embed-Dependency>
<Import-Package> javax.annotation;version=0.0.0,* </Import-Package>
                                ]]></bnd>
</configuration>

 

But no luck, could you please check and let us know if any inputs.

Thanks,
Sagar V

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 5
Level 2
GnanendraPonnala
Level 2

Likes

5 likes

Total Posts

14 posts

Correct reply

2 solutions
Top badges earned
Boost 5
Establish
Affirm 1
Boost 3
Boost 1
View profile

Avatar
Boost 5
Level 2
GnanendraPonnala
Level 2

Likes

5 likes

Total Posts

14 posts

Correct reply

2 solutions
Top badges earned
Boost 5
Establish
Affirm 1
Boost 3
Boost 1
View profile
GnanendraPonnala
Level 2

28-06-2021

Hi @SagarVerliani,

 

1.One way to resolve is, If you added dependency to project and resolved in pom.xml in IDE in local,
go to your local repository .m2 folder (.m2\repository\log4j\log4j\1.2.12) get your jar according to dependency values and deploy it manually in OSGI Console.

 

GnanendraPonnala_1-1624949176137.png

 


2. The other way make use of Depfinder in OSGI console(http://localhost:4502/system/console/depfinder) to get required version of that bundle and download.

 

Thanks,

Gnanendra

 

Answers (3)

Answers (3)

Avatar

Avatar
Boost 5
Level 7
Ritesh_M
Level 7

Likes

179 likes

Total Posts

142 posts

Correct reply

45 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 1
View profile

Avatar
Boost 5
Level 7
Ritesh_M
Level 7

Likes

179 likes

Total Posts

142 posts

Correct reply

45 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 1
View profile
Ritesh_M
Level 7

28-06-2021

hi @SagarVerliani ,

 

You can simply use Eclipse plug-in project to convert the JAR into an OSGi bundle and deploy the bundle to AEM.
please refer below video

https://www.youtube.com/watch?v=EXyvsIknCLI

 

Also, attaching the bundle which i created. Try using this.

https://github.com/riteshmittal/dom4jbundle

 

Also, check the threads-

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/included-dependency-jar-is...

SagarVerliani

Hi @Ritesh_M
After installing the jar from github, dom4j jar is in installed state only and also
getting this error logs

org.osgi.framework.BundleException: Unable to resolve dom4j-bundle [626](R 626.0): missing requirement [dom4j-bundle [626](R 626.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=15.0.0)) Unresolved requirements: [[dom4j-bundle [626](R 626.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=15.0.0))]
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4368)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2281)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)
at org.apache.felix.webconsole.internal.core.InstallHelper.doRun(InstallHelper.java:67) [org.apache.felix.webconsole:4.3.12]
at org.apache.felix.webconsole.internal.core.BaseUpdateInstallHelper.doRun(BaseUpdateInstallHelper.java:99) [org.apache.felix.webconsole:4.3.12]
at org.apache.felix.webconsole.internal.core.BaseUpdateInstallHelper.run(BaseUpdateInstallHelper.java:171) [org.apache.felix.webconsole:4.3.12]
at java.base/java.lang.Thread.run(Thread.java:834)
29.06.2021 13:01:02.575 *ERROR* [FelixDispatchQueue] dom4j-bundle FrameworkEvent ERROR (org.osgi.framework.BundleException: Unable to resolve dom4j-bundle [626](R 626.0): missing requirement [dom4j-bundle [626](R 626.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=15.0.0)) Unresolved requirements: [[dom4j-bundle [626](R 626.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=15.0.0))])
org.osgi.framework.BundleException: Unable to resolve dom4j-bundle [626](R 626.0): missing requirement [dom4j-bundle [626](R 626.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=15.0.0)) Unresolved requirements: [[dom4j-bundle [626](R 626.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=15.0.0))]
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4368)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2281)
at org.apache.felix.framework.Felix.setBundleStartLevel(Felix.java:1727)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:338)
at java.base/java.lang.Thread.run(Thread.java:834)
29.06.2021 13:01:02.578 *INFO* [OsgiInstallerImpl] org.apache.sling.installer.core.impl.tasks.BundleStartTask Could not start bundle barclays-ad-server.core [624]. Reason: {}. Will retry.

Avatar

Avatar
Boost 500
MVP
Vijayalakshmi_S
MVP

Likes

587 likes

Total Posts

735 posts

Correct reply

246 solutions
Top badges earned
Boost 500
Give Back 50
Give Back 5
Ignite 10
Ignite 5
View profile

Avatar
Boost 500
MVP
Vijayalakshmi_S
MVP

Likes

587 likes

Total Posts

735 posts

Correct reply

246 solutions
Top badges earned
Boost 500
Give Back 50
Give Back 5
Ignite 10
Ignite 5
View profile
Vijayalakshmi_S
MVP

29-06-2021

Hi @SagarVerliani,

Per the snippets you shared in your original post, could see that you have used "Embed-Dependency" entry in bnd-maven-plugin. (while the same is applicable for maven-bundle-plugin

 

In case you are using maven-bundle-plugin as part of code package (core module), Have the desired dependency entry in core and main pom.xml and in plugin definition add the below.

<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency> // "*" Denotes all dependency as part of <dependencies> entry in pom.xml
<Embed-Transitive>true</Embed-Transitive> // Includes RunTime/compile time dependencies of each of the dependency in turn. Example: all Run time dependencies of org.dom4j

For bnd-maven-plugin

Avatar

Avatar
Affirm 25
Level 5
Bimmi_Soi
Level 5

Likes

79 likes

Total Posts

83 posts

Correct reply

28 solutions
Top badges earned
Affirm 25
Contributor
Applaud 5
Boost 50
Ignite 1
View profile

Avatar
Affirm 25
Level 5
Bimmi_Soi
Level 5

Likes

79 likes

Total Posts

83 posts

Correct reply

28 solutions
Top badges earned
Affirm 25
Contributor
Applaud 5
Boost 50
Ignite 1
View profile
Bimmi_Soi
Level 5

29-06-2021