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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

JSOUP not getting resolved

s1101v
Level 3
Level 3

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>

1 Accepted Solution
Arun_Patidar
Correct answer by
Community Advisor
Community Advisor
2 Replies
KiranVedantam1992
Community Advisor
Community Advisor

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.

s1101v
Level 3
Level 3
@KiranVedantam1992 - I have already tried this as well. This jar needs to be included in my project's bundle so I added <Embed-Dependency> in core module POM but it is not including in the bundle.
KiranVedantam1992
Community Advisor
Community Advisor
Hi s1101v, please add it in the install folder of the instance to check if it gets installed
s1101v
Level 3
Level 3
@KiranVedantam1992 - I have installed the bundle in the instance as well. I still see issues with the JSOUP bundle. I have extracted the project bundle as well, the included jar is not available.
Anudeep_Garnepudi
Community Advisor
Community Advisor

@s1101v 

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>
Anudeep_Garnepudi
Community Advisor
Community Advisor

@s1101vDid you remove Embed-Dependency? If no remove it. Add remove system scope also. Check in Exported Packages list.

jsoup.PNG

s1101v
Level 3
Level 3
@Anudeep_Garnepudi - I have already removed scope, systempath and also embed-dependency as well. I see the issue in "Import Packages" section, so I have added <Import-Package>org.jsoup.*</Import-Package>. The bundle is not getting resolved.
Anudeep_Garnepudi
Community Advisor
Community Advisor
You don't need to add in Import-Package, add it in Export-Package and try once
Arun_Patidar
Correct answer by
Community Advisor
Community Advisor
s1101v
Level 3
Level 3
@Arun_Patidar - I have already gone through this link. If I add/install the jsoup jar separately in console, the bundle gets resolved but I don't want to install the required bundles separately. Basically I just wanted to include it in project bundle itself. I am getting the error in "Import Packages" section.
Arun_Patidar
Community Advisor
Community Advisor
you can simple copy the bundle jar in your java core project and copy this bundle from core to ui.app similar to app bundle.