JasperReports 6.2.1 classes import from com.lowagie.*

I have been getting NoClassDefFoundError for com.lowagie.text.DocumentException:

Exception in thread "main" java.lang.NoClassDefFoundError: com/lowagie/text/DocumentException

at net.sf.jasperreports.engine.JasperExportManager.exportToPdfFile(JasperExportManager.java:151)

at net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfFile(JasperExportManager.java:504)

at ca.polarisfinancial.JasperTest.Main.main(Main.java:28)

I have itextpdf-5.5.9.jar on my classpath, but after digging into it a little bit I realized that some of the code distributed with 6.2.1 is pointing to the old package, for example:

JRPdfExporter.java in net.sf.jasperreports.engine.export has the following import defined:

import com.lowagie.text.DocumentException;

instead of

import com.itextpdf.text.DocumentException;

 
Is that intentional?   If so, what can I do to fix it?

 

chris_48's picture
Joined: Mar 18 2016 - 8:13am
Last seen: 4 years 3 weeks ago

Thanks hozawa, that was the issue.  

For anyone else having the same problem, the customized version referred to below is available at:

http://jasperreports.sourceforge.net/maven2/com/lowagie/itext/2.1.7.js1/

 

 

chris_48 - 6 years 8 months ago

1 Answer:

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.

hozawa's picture
154796
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 5 months ago
Feedback
randomness