2

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
5
  • 1
    Make sure you have the itext jar file in your classpath Sep 7, 2015 at 5:50
  • i already added itext.jar Sep 7, 2015 at 9:04
  • 1
    i already added itext.jar - which version? Your JR version seems to require the old com.lowagie.** iText flavor, i.e. a version before 5.0.0. Since then iText uses a com.itextpdf.** package hierarchy.
    – mkl
    Sep 7, 2015 at 11:02
  • i am using itext 5.0.6 jar file Sep 7, 2015 at 11:10
  • 5.0.6 is the wrong version. Jasper Reports uses 2.1.7, with com.lowagie.** packages. Nov 25, 2016 at 9:56

3 Answers 3

1

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

1

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.
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.