Thirunavukkarasu
Thirunavukkarasu

Reputation: 208

NoClassDefFoundError while export to pdf

I am facing error at the time of export jasper report into pdf. That shows NoClassDefFoundError. I tried somany things like added recent itextPdf jar and itext jar. Then i moved those file into ext sub folder of lib. but, i have no luck can any one tell me, what was the problem?

This is my code:

JasperPrint jprint = (JasperPrint) JasperFillManager.fillReport(jasperFileName, param, conn);
        JasperExportManager.exportReportToPdfFile(jprint, pdfFileName); //exportReportToPdf(jprint);
        JasperViewer.viewReport(jprint);

Here my Problem:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/lowagie/text/DocumentException

Upvotes: 2

Views: 4012

Answers (3)

Rajitha Bhanuka
Rajitha Bhanuka

Reputation: 842

JasperReports library is using customized version of itext 2.1.7. You'll have to use this version because itext is not compatilble between versions 2.x and 5.x.

Upvotes: 0

Takatam
Takatam

Reputation: 121

There are at least two good ways to solve this and possible similar problems:

  1. Use Maven to handle dependencies.
  2. Copy the folder "lib" from the Jasper Reports library to your project and add all the jars from it to your build path.

Upvotes: 1

Jens
Jens

Reputation: 69440

you miss the itext.jar in your classpath. Download and add it, so the exception will gone.

Upvotes: 1

Related Questions