我已在我的项目上实施动态报告以生成pdf报告(版本4.0.0),但我收到了严重错误:
GRAVE:El Servlet.service()para el servlet [com.pkg.svt_pdf] en el contexto con ruta [/ WEB]lanzólaexiverspción[LaejecucióndelServletlanzóunaaexpción] concausaraíz java.lang.NoSuchMethodError:com.itextpdf.text.Document.setRole(Lcom / itextpdf / text / pdf / PdfName;)V at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:580) at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:519) at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.export(JasperReportBuilder.java:630) at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.toPdf(JasperReportBuilder.java:532) 在com.pkg.reports.ReportsGenerator.exportPDF(ReportsGenerator.java:73) 在com.pkg.svt_pdf.doGet(svt_pdf.java:53) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:620) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:727) 在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) 在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) 在org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) 在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) 在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) 在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) 在org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) 在org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) 在org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) 在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) 在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) 在org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) at org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process(AbstractProtocol.java:611) 在org.apache.tomcat.util.net.AprEndpoint $ SocketProcessor.doRun(AprEndpoint.java:2440) 在org.apache.tomcat.util.net.AprEndpoint $ SocketProcessor.run(AprEndpoint.java:2429) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61) 在java.lang.Thread.run(Thread.java:745)
这是我的代码:
AbstractJasperExporterBuilder exporter = export.pdfExporter(output); exporter.setCharacterEncoding("UTF-8"); JasperReportBuilder jrb = JRBuild(connection); jrb.toPdf((JasperPdfExporterBuilder) exporter);
此行中的错误:
jrb.toPdf((JasperPdfExporterBuilder) exporter);