gpt4 book ai didi

java - com.lowagie.text.pdf.PdfWriter.setRgbTransparencyBlending(Z)

转载 作者:行者123 更新时间:2023-12-02 05:49:13 28 4
gpt4 key购买 nike

我一直在尝试使用JasperReports生成报告,但收到此错误:

WARNING: #{order_approval.print}: java.lang.NoSuchMethodError: com.lowagie.text.pdf.PdfWriter.setRgbTransparencyBlending(Z)V
javax.faces.FacesException: #{order_approval.print}: java.lang.NoSuchMethodError: com.lowagie.text.pdf.PdfWriter.setRgbTransparencyBlending(Z)V
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at mtr.SessionFilter.doFilter(SessionFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: javax.faces.el.EvaluationException: java.lang.NoSuchMethodError: com.lowagie.text.pdf.PdfWriter.setRgbTransparencyBlending(Z)V
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
... 29 more
Caused by: java.lang.NoSuchMethodError: com.lowagie.text.pdf.PdfWriter.setRgbTransparencyBlending(Z)V
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:528)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:383)
at net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfFile(JasperExportManager.java:122)
at to_pages.order_approval.print(order_approval.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.el.parser.AstValue.invoke(AstValue.java:262)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
... 30 more

这是 bean 中的代码。

try {
String reportPath = FacesContext.getCurrentInstance()
.getExternalContext().getRealPath("reports");
System.err.println(reportPath + "\\report1.jrxml");

JasperCompileManager
.compileReportToFile(
"C:\\reports\\report1.jrxml",
"C:\\reports\\report1.jasper");
System.err.println(reportPath);
JRBeanCollectionDataSource beanCollectionDataSource = new JRBeanCollectionDataSource(
orders);
System.err.println(reportPath);

JasperPrint jasperPrint = JasperFillManager
.fillReport(
"C:\\Projects\\reports\\report1.jasper",
new HashMap<String, Object>(),
beanCollectionDataSource);
System.err.println("Check");
JasperExportManager
.exportReportToPdfFile(jasperPrint,
"C:\\Projects\\reports\\report1.pdf");
System.err.println("Check");
} catch (JRException e) {
System.out.println(e);
}

我正在使用 jasperreports 4.1.3 .jar 和 itextpdf 5.4.5 .jar

最佳答案

:

java.lang.NoSuchMethodError: 
com.lowagie.text.pdf.PdfWriter.setRgbTransparencyBlending(Z)V

告诉您,在com.lowagie.text.pdf.PdfWriter类中,您使用的setRgbTransparencyBlending(Z)V方法不存在。通常这种情况发生在使用不需要的 jar 版本时。

com.lowagie.text.pdf.PdfWriter类中找到包含方法setRgbTransparencyBlending(Z)V的jar的适当版本:我猜 itext-2.1.7.jar.

关于java - com.lowagie.text.pdf.PdfWriter.setRgbTransparencyBlending(Z),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23733947/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com