This question already has an answer here:
- How do I fix a NoSuchMethodError? 28 answers
I run in Tomcat, jasper report crashed with PDF, excel still running fine.
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
ByteArrayOutputStream os = new ByteArrayOutputStream();
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(os));
exporter.exportReport();
And error shot out:
java.lang.NoSuchMethodError: com.lowagie.text.pdf.PdfWriter.setRgbTransparencyBlending(Z)V
net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:480)
net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:379)
net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfFile(JasperExportManager.java:122)
ReportServlet.processRequest(ReportServlet.java:104)
ReportServlet.doGet(ReportServlet.java:142)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
I use the following libraries: - iText-2.1.7.js2.jar - itext-4.2.0.jar - itextpdf-5.5.0.jar - jasperreports-5.6.0.jar - jasperreports-fonts-5.6.0.jar - jasperreports-javaflow-5.6.0.jar
Thanks for your help!
Your itext version is old as compared to jasperreports version. Please use the latest version. Note that the artifactId and/or groupId have changed:-
After using the latest version 5.5.13, I checked that the war file after the build file has version text-2.0.8 and caused errors. So how to do to fix?
Here is build.grade file: