我正在尝试将D3js与我们的jasper报告集成,当我从jasper工作室运行时,带有d3图表的报告正常工作。 但是当从spring应用程序执行时,jasper报告无法加载JavaScript文件。
我现在要做的是将文件作为输入流放在参数
中parameters.put("res_js_Page2_cell3",cacheService.getJasperInputStream("d3charts/Page2_pie/d3_piechart.min.js"));
报告中:
<cvc:itemProperty name="script">
<valueExpression><![CDATA[$P{res_js_Page2_cell3}]]></valueExpression>
</cvc:itemProperty>
错误:
net.sf.jasperreports.engine.JRRuntimeException: No script provided for the Custom Visualization component.
at com.jaspersoft.jasperreports.customvisualization.fill.CVFillComponent.loadResource(CVFillComponent.java:465)
at com.jaspersoft.jasperreports.customvisualization.fill.CVFillComponent.evaluationPerformed(CVFillComponent.java:327)
at com.jaspersoft.jasperreports.customvisualization.fill.CVFillComponent.evaluateDelayedElement(CVFillComponent.java:257)
at net.sf.jasperreports.engine.fill.JRFillComponentElement.resolveElement(JRFillComponentElement.java:219)
at net.sf.jasperreports.engine.fill.JRFillElement.performDelayedEvaluation(JRFillElement.java:1131)
at net.sf.jasperreports.engine.fill.JRFillComponentElement.resolveElement(JRFillComponentElement.java:212)
at net.sf.jasperreports.engine.fill.ElementEvaluationAction.execute(ElementEvaluationAction.java:69)
at net.sf.jasperreports.engine.fill.DelayedFillActions.runActions(DelayedFillActions.java:269)
at net.sf.jasperreports.engine.fill.BaseReportFiller.resolveBoundElements(BaseReportFiller.java:771)
at net.sf.jasperreports.engine.fill.JRBaseFiller.resolveReportBoundElements(JRBaseFiller.java:1093)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillSummary(JRVerticalFiller.java:1047)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportEnd(JRVerticalFiller.java:286)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:122)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:582)
at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:396)
at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:732)
at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:59)
at net.sf.jasperreports.engine.fill.AbstractThreadSubreportRunner.run(AbstractThreadSubreportRunner.java:221)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: net.sf.jasperreports.engine.JRRuntimeException: No script provided for the Custom Visualization component.
at com.jaspersoft.jasperreports.customvisualization.fill.CVFillComponent.loadResource(CVFillComponent.java:456)
... 20 more