I have createad a report in jasper report, when i have wrote the code in servlet to export the report in pdf it is not displaying the report.
JRPdfExporter pdfExporter = new JRPdfExporter();
pdfExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
//OutputStream ouputStream = response.getOutputStream();
//pdfExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);
pdfExporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "C:/reports/payment.pdf");
pdfExporter.exportReport();
Now during debugging when debugger came to at this line JRPdfExporter pdfExporter = new JRPdfExporter(); it simply goes in finally block rather in next line. I am stuck into this any solutions.
and the Exception is:
java.lang.NoClassDefFoundError: com/lowagie/text/DocumentException
java.lang.ClassNotFoundException: com.lowagie.text.DocumentException
Your code looks fine, and It compiles and runs correctly. I suspect that problem is inside
JasperPrint. Make sure you actually complie aJasperPrintfrom your JRXML file.If you set an empty
JasperPrintinto theJRPdfExporter, it will still runs correctly, but will result an empty PDF file.Hope this help you locate the error.
EDIT :
these Exception messages you provided are indicated that JVM can not locate
DocumentException, according to package name, that’s a class from iText library, if you have used iText, make sure you have included iText in your classpath.