runtime error for org.xhtmlrenderer.pdf.ITextRenderer | Community
Skip to main content
New Participant
Nov 3, 2020 10:56 AM UTC
Solved

runtime error for org.xhtmlrenderer.pdf.ITextRenderer

I am trying to do a poc for html to pdf generation.

I am using the dependency as below. 

 

<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 

<Import-Package>javax.inject;version=0.0.0,org.xhtmlrenderer.*;resolution:=optional,*</Import-Package>

 

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

 

Anyone please help ? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
kiranparabAccepted solution
Level 3
Nov 3, 2020 4:08 PM UTC

Looks like Depedency is not enough to cover this package to get imported for PDF package "org.xhtmlrenderer.pdf.ITextRenderer iTextRenderer" as it is still in installed state.

 

If you are building this using Eclipse, After package build please see if you find the below JAR getting downloaded in Eclipse with this respected class available "org.xhtmlrenderer.pdf.ITextRenderer iTextRenderer". If not means you are missing the depdency to fullfill the package requirement for "org.xhtmlrenderer.pdf.ITextRenderer iTextRenderer".

 

4 replies

kiranparabAccepted solution
Level 3
Nov 3, 2020 4:08 PM UTC

Looks like Depedency is not enough to cover this package to get imported for PDF package "org.xhtmlrenderer.pdf.ITextRenderer iTextRenderer" as it is still in installed state.

 

If you are building this using Eclipse, After package build please see if you find the below JAR getting downloaded in Eclipse with this respected class available "org.xhtmlrenderer.pdf.ITextRenderer iTextRenderer". If not means you are missing the depdency to fullfill the package requirement for "org.xhtmlrenderer.pdf.ITextRenderer iTextRenderer".

 

Translate
Anudeep_Garnepudi
New Participant
Nov 3, 2020 11:23 AM UTC

Hi @dipanjan1986 

Does itextpdf is in your bundle classpath? If not try adding to your bundle and check once.

AG

Translate
New Participant
Nov 3, 2020 12:15 PM UTC

I already tried that option  with <Embed-Dependency> and <Bundle-ClassPath>. Bundle becomes in 'installed' state. and the errors comes as below.

com.itextpdf.text,version=[5.5,6) -- Cannot be resolved
com.itextpdf.text.pdf,version=[5.5,6) -- Cannot be resolved
com.lowagie.text,version=[1.3,2) -- Cannot be resolved
com.lowagie.text.pdf,version=[1.3,2) -- Cannot be resolved

Translate