Hello All - I am getting the below error because of that, OSGi bundle is not starting.
org.jsoup,version=[1.9,2) -- Cannot be resolved
org.jsoup.nodes,version=[1.9,2) -- Cannot be resolved
org.jsoup.select,version=[1.9,2) -- Cannot be resolved
Basically I just wanted to include JSOUP jar that should be embedded in my project's bundle. I tried adding the below to include the JSOUP in the bundle. I am using latest archetype (23), Can someone advise on how to include the embed the bundle.
Also please note that, I have already placed the required JSOUP jar in the "libs" folder.
<properties>
<system.dependencies>${project.basedir}/libs</system.dependencies>
</properties>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.9.2</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${system.dependencies}/jsoup-1.9.2.jar</systemPath>
</dependency>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>4.1.0</version>
<inherited>true</inherited>
<configuration>
<instructions>
<Bundle-SymbolicName>com.test.core</Bundle-SymbolicName>
<Sling-Model-Packages>
com.test.core.internal.impl.models
</Sling-Model-Packages>
<Embed-Dependency>jsoup</Embed-Dependency>
</instructions>
</configuration>
</plugin>
Solved! Go to Solution.
Views
Replies
Total Likes
Please check if this help
Hi @s1101v,
The below error says that the JSOUP bundle is not resolved. To resolve the issue, check my answer here.
If you are trying to include JSOUP Jar, AEM does not support it. You need to install a bundle into AEM. Use this dependency in your pom and follow the steps mentioned in the above link.
<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.13.1</version>
</dependency>
Hope this helps.
Thanks,
Kiran Vedantam.
In Export-Package add org.jsoup.*, it should work.
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.9.2</version>
</dependency>
<Export-Package>org.jsoup.*</Export-Package>
Please check if this help
you can simple copy the bundle jar in your java core project or copy this bundle from core to ui.app similar to app bundle.
Hi @s1101v
How did you resolve this?
Views
Replies
Total Likes
I faced similar issue and I am able to solve this. This is because your core bundle is looking for the jsoup bundle and it is missing in out of all of your 600 or 700 available bundles in your aem. So what we have to do is make this bundle available in your AEM.
1. Add jsoup(or any other third party dependencies) dependency in main and core pom.xml.
2. Go to core pom.xml and find the plug-in with artifact id bnd-maven-plugin. Now edit the plugin like below
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<executions>
<execution>
<id>bnd-process</id>
<goals>
<goal>bnd-process</goal>
</goals>
<configuration>
<bnd><![CDATA[
Import-Package: javax.annotation;version=0.0.0,org.jsoup.*;version=1.8.1,*
]]></bnd>
</configuration>
</execution>
</executions>
</plugin>
3. Now save the core pom.xml
4. Now you have to embed this package in ui.all module pom.xml in org.apache.jackrabbit plugin groupID
<embedded>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<target>/apps/wknd-packages/application/install</target>
</embedded>
Note: Change your target folder accordingly to your project.
5. You are done now and deploy the code to your AEM. Now you can see jsoup jar got added into your target folder and if you go to bundles console and search for jsoup then you can see jsoup bundle got added into your aem bundles.
6. Now you can't see jsoup cannot resolve error in your core bundle.
If above steps not works for you then you manually download the related jar present in /apps target folder and try to upload via bundles console. If you get any errors while upload means that your bundle is missing Bundle-SymbolicName or Import-Package or other bundle manifest headers might be missing. In this case you need to manually edit the downloaded bundle via eclipse like converting the jar to osgi bundle in eclipse. There is some process to convert jar into bundle in eclise, google it. While in converting process add the required manifest headers like Import-Package/Export-Package etc.. In Import-Package section if nothing is present in your manifest file then you need to add the required pacakges(take the ref from existing bundle manifest file in your AEM). Putting same version of your jsoup dependency for Import Package is very Important.
See sample core pom.xml: https://github.com/adobe/aem-guides-wknd/blob/main/core/pom.xml
See sample all pom.xml: https://github.com/adobe/aem-guides-wknd/blob/main/all/pom.xml
Hi @Uppari_Ramesh ,
I have tried the above method but im getting build failure in all module.
Could you please help fixing this.
Error :
val : 2023-12-31 (com.carrybag:carry-bag.all:1.0.0-SNAPSHOT)
[ERROR] The analyser found the following errors for author and publish :
[ERROR] [api-regions-exportsimports] com.carrybag:carry-bag.core:1.0.0-SNAPSHOT: Bundle carry-bag.core:1.0.0-SNAPSHOT is importing package(s) [org.jsoup.select, org.jsoup, org.jsoup.nodes] in start level 20 but no bundle is exporting these for that start level. (com.carrybag:carry-bag.all:1.0.0-SNAPSHOT)
I have posted the same with more info : https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/build-issue-while-adding-j...
Views
Replies
Total Likes
I added the dependencies on pom.xml of core (as I have my servlets inside core)
<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.14.3</version>
</dependency>
and ran below command on the path \.m2\repo1\m3-3.5.4\org\jsoup\jsoup\1.14.3.
mvn install:install-file -Dfile=jsoup.jar(or add path to jsoup.jar) -DgroupId=org.jsoup -DartifactId=jsoup -Dversion=1.14.3 -Dpackaging=jar
the error above is resolved.
Give it a try.
Views
Replies
Total Likes