我正在使用birt-2_6_1与tomcat 7以及eclipse IDE生成报告。我已经完成了生成图表的编码并将它们保存在tem位置作为png格式。但是当我在可下载的pdf文件中导出这些图像时,它不会以pdf格式或excel格式将这些图像显示为下载文件。它是否抛出了这个例外:
java.net.MalformedURLException: no protocol: /Softwares/new_tomcat/tomcat7/temp/jfreechart-299441806335424490.png
at java.net.URL.<init>(URL.java:567)
at java.net.URL.<init>(URL.java:464)
at java.net.URL.<init>(URL.java:413)
at org.eclipse.birt.report.engine.emitter.ImageReader.readImage(ImageReader.java:179)
at org.eclipse.birt.report.engine.emitter.ImageReader.read(ImageReader.java:80)
at org.eclipse.birt.report.engine.nLayout.area.impl.ImageAreaLayout.initialize(ImageAreaLayout.java:83)
at org.eclipse.birt.report.engine.nLayout.area.impl.ImageAreaLayout.layout(ImageAreaLayout.java:72)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.startContent(LayoutEngine.java:488)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startImage(ContentEmitterAdapter.java:174)
at org.eclipse.birt.report.engine.emitter.CompositeContentEmitter.startImage(CompositeContentEmitter.java:274)
at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:74)
at org.eclipse.birt.report.engine.layout.html.buffer.HTMLPageBuffer.startContent(HTMLPageBuffer.java:116)
at org.eclipse.birt.report.engine.layout.html.buffer.TableBreakBuffer.startContent(TableBreakBuffer.java:287)
at org.eclipse.birt.report.engine.layout.html.HTMLLeafItemLM.start(HTMLLeafItemLM.java:67)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:139)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:90)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:99)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:180)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
at com.i10n.fleet.util.ReportExporter.**exportReport(ReportExporter.java:98**)
at com.i10n.fleet.web.controllers.ExportReportOperations.**ExportVehicleReport(ExportReportOperations.java:596)**
at com.i10n.fleet.web.controllers.ExportReportOperations.**generateVehicleReport(ExportReportOperations.java:497)**
at com.i10n.fleet.web.controllers.ExportReportsController.**processRequest(ExportReportsController.java:131)**
at com.i10n.fleet.web.controllers.ExportReportsController.**handleRequestInternal(ExportReportsController.java:71)**
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at com.i10n.fleet.web.controllers.CascadedFormController.handleRequest(CascadedFormController.java:47)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:859)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:793)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
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:161)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:558)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:282)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:357)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1687)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
我用于此任务的所有上述粗体字母文件。但它在这一行显示错误:
vehicleReportTask.run();
其中vehicleReportTask
是RunAndRenderTask
,它将png图像保存在报告中。这就是我存储到任务中的方式:
vehicleReportTask.setParameterValue("image", imgPath + filename);
它从很长一段时间就给出同样的错误,所以如果有人能帮我解决这个问题,那对我来说将是非常有帮助的。如果有任何需要作为输入随时问。 我可以邮寄给你我需要的电子邮件地址是:vikramfartyal@gmail.com
答案 0 :(得分:4)
java.net.MalformedURLException: no protocol
表示缺少协议,例如http://
file://
。
尝试通过向file:///Softwares/new_tomcat/tomcat7/temp/jfreechart-299441806335424490.png
添加协议前缀来传递这样的网址:imgPath
。