我正在使用 JasperReports 5.0.0 在我的 Java 应用程序中制作报告。
当我从文件加载和编译报告时,.jrxml
它没有问题。
但是当我尝试从已编译的报告(.jasper
文件)中加载它们时,它会毫无例外地停止操作!我用一个 try 语句
包围了语句,它像这样捕获: JasperFillManager.fillReport
Throwable
jasperReport = (JasperReport) JRLoader.loadObject(new FileInputStream(new File(Main.jarpath,Main.REPORT_TEMPLATE)));
try{
jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, new JRBeanCollectionDataSource(data));
}catch(Throwable ex){
ex.printStackTrace();
}
现在它打印这个异常:
java.lang.NoSuchMethodError: groovy.lang.MetaClassImpl.createPogoCallCurrentSite(Lorg/codehaus/groovy/runtime/callsite/CallSite;Ljava/lang/Class;[Ljava/lang/Object;)Lorg/codehaus/groovy/runtime/callsite/CallSite;
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallCurrentSite(CallSiteArray.java:108)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at pe_report_1367344395908_105126.customizedInit(calculator_pe_report_1367344395908_105126:87)
at net.sf.jasperreports.engine.fill.JREvaluator.init(JREvaluator.java:88)
at net.sf.jasperreports.engine.fill.JRCalculator.init(JRCalculator.java:111)
at net.sf.jasperreports.engine.fill.JRFillDataset.initCalculator(JRFillDataset.java:469)
at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:529)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:88)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:103)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:61)
at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:153)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:82)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:653)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:969)
at pe.reporting$1.doInBackground(reporting.java:75)
at pe.reporting$1.doInBackground(reporting.java:41)
at javax.swing.SwingWorker$1.call(SwingWorker.java:278)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at javax.swing.SwingWorker.run(SwingWorker.java:317)
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)
问题是什么?