Reputation: 15158
I'm using JasperReports 5.0.0 to make reports in my Java application.
When I load & compile report from .jrxml
file it has no problem.
But when I try to load them from compiled report (.jasper
file) it stops operation without any exception!
I surrounded JasperFillManager.fillReport
statement with a try statement that catch Throwable
like this:
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();
}
Now it prints this exception:
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)
What is the problem?
Upvotes: 2
Views: 3551
Reputation: 14212
This is a classpath issue related to the groovy jar. If you are using groovy for your expressions you need to add the groovy jar to your classpath.
To find the one you need the easy way is to:
If you are not using groovy in your report, you may be able to simply remove the language
atrribute in the jasperReport xml tag in the jrxml altogether. This (at least in older versions) defaulted it to java usage for expressions.
Upvotes: 2