Run time error java.lang.ClassNotFoundException not found by org.xhtmlrenderer.flying.saucer.pdf.itext5 [613] | Community
Skip to main content
Level 4
December 12, 2023

Run time error java.lang.ClassNotFoundException not found by org.xhtmlrenderer.flying.saucer.pdf.itext5 [613]

 I'm working on the implementation of html to pdf generation, where i have done below pom config,

 

<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-core</artifactId>
<version>9.1.20</version>
</dependency>
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf-openpdf</artifactId>
<version>9.1.20</version>
</dependency>
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf-itext5</artifactId>
<version>9.1.20</version>
</dependency>

<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf-osgi</artifactId>
<version>9.1.2</version>
</dependency>
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-core</artifactId>
<version>9.1.20</version>
</dependency>

<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf-openpdf</artifactId>
<version>9.1.20</version>
</dependency>
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf</artifactId>
<version>9.1.20</version>
</dependency>

 

and in plugin I have added this line 

<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[
Export-Package:
com.itextpdf;version="5.5.6",\
com.itextpdf.text;version="5.5.6",\
com.itextpdf.text.pdf;version="5.5.6",\
com.lowagie;version="2.1.7",\
org.xhtmlrenderer;version="9.1.20",\
org.xhtmlrenderer.pdf.ITextRenderer.*;version="9.1.20",\

 

The build is fine and the bundle is active. 

In my code I am able to get the apis of ITextRenderer. 

org.xhtmlrenderer.pdf.ITextRenderer iTextRenderer = new org.xhtmlrenderer.pdf.ITextRenderer();

 

But on Runtime I am getting this exception in error.log.

java.lang.ClassNotFoundException: org.xhtmlrenderer.pdf.ITextRenderer

 

could you please suggest anyone ?

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

7 replies

kautuk_sahni
Employee
January 2, 2024

@karthickve Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Translate
Kautuk Sahni
Level 4
January 23, 2024

@kautuk_sahni , Currently i'm using workaround so i'm still looking for solution.

 

Thanks

Translate
Sudheer_Sundalam
New Participant
December 12, 2023

@karthickve,

Try embedding these 3rd party jar file along with the bundle. You can follow this article on how to embed the 3rd party jars in maven build.

https://myaemlearnings.blogspot.com/2021/08/embedding-third-party-dependencyosgi.html

Translate
Level 4
December 12, 2023

Hello Sudeer,

its already embedded in all/pom.xml.

 

And its working fine in on prem AEM and java 1.8, the problem arose in AEMaaCS. not sure is it becasue of java 11??

Translate
New Participant
December 12, 2023

Hi @karthickve,

Did you try following things?

  • Restarting AEM instance
  • Using different version of the dependency
  • Check the scope of the dependency. It has to be available at runtime as well. Try with scope "provided".
  • Checking any other error in stack trace.
Translate
Level 4
December 12, 2023

Hello @salamswapnil ,

  • Restarting AEM instance - tried but same result.
  • Using different version of the dependency -tried but causing more issue. same version works fine in on prem AEM.
  • Check the scope of the dependency. It has to be available at runtime as well. Try with scope "provided". - its already added
  • Checking any other error in stack trace. - not finding anything useful.
Translate