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

Third party jar JSoup jar for Html parsing not working

Avatar

Level 4

Hi,

  I have created the OSGI bundle for opencsv jar and put it in fleix console.I couldn't able to import the class file in my apps ??

Then I used JSoup jar ,for that i downloaded the sources and put in the project under apps and deployed it .I can able to use the methods from that jsoup java class now but it showing this exception "exception “Could not initialize class org.jsoup.nodes.Entities$EscapeMode java.lang.NoClassDefFoundError: Could not initialize class org.jsoup.nodes.Entities$EscapeMode”" .

 

Please suggest me a solution.Its very urgent

 

Thanks in advance.

1 Accepted Solution

Avatar

Correct answer by
Level 10

I wanted to test this use case to make sure that there were not any issue using the JSOUP API within AEM.

So i created an OSGi bundle that uses the JSOUP API to define a custom AEM HTML parser service. It works perfectly:

[img]App.png[/img]

Then I wrote up a community article that walks you through how to build an OSGi bundle that uses the JSOUP API. This article provides step by step instructions. 

http://helpx.adobe.com/experience-manager/using/html-parser-service.html

View solution in original post

2 Replies

Avatar

Level 10

Sounds like you have not deployed the JSOUP JAR file into an OSGi bundle fragment and deployed that bundle fragment to CQ.

I recommend using the Eclipse Plug-in project to wrap your 3rd party JAR into a bundle fragment. Then you deploy that to CQ.

As a example of how to do this... see this topic:

"Add the org.json.simple.JSONObject data type to Adobe CQ" in this community article: http://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html

Replace the JSON lib in that article -- with the JSOUP JAR. 

Avatar

Correct answer by
Level 10

I wanted to test this use case to make sure that there were not any issue using the JSOUP API within AEM.

So i created an OSGi bundle that uses the JSOUP API to define a custom AEM HTML parser service. It works perfectly:

[img]App.png[/img]

Then I wrote up a community article that walks you through how to build an OSGi bundle that uses the JSOUP API. This article provides step by step instructions. 

http://helpx.adobe.com/experience-manager/using/html-parser-service.html