Dom4j bundle || unable to resolve in OSGI | Community
Skip to main content
Level 2
June 29, 2021
Solved

Dom4j bundle || unable to resolve in OSGI

  • June 29, 2021
  • 4 replies
  • 2620 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by GnanendraPonnala

Hi @user21583,

 

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.

 

 


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

 

4 replies

Ritesh_Mittal
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
June 29, 2021

hi @user21583 ,

 

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-not-resolving-in-bundle/qaq-p/227487

user21583Author
Level 2
June 29, 2021

Hi @ritesh_mittal
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.

GnanendraPonnala
GnanendraPonnalaAccepted solution
Level 2
June 29, 2021

Hi @user21583,

 

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.

 

 


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

 

GnanendraPonnala
Level 2
July 1, 2021
Hi @kautuk_sahni, sure thanks!
Adobe Employee
June 29, 2021
Vijayalakshmi_S
Level 10
June 29, 2021

Hi @user21583,

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