gpt4 book ai didi

java - java 中的 org/codehaus/groovy/control/CompilationFailedException

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

我是java报告部分的初学者。我在互联网上找到了代码,当我调用 jFrame 时,我成功创建了 jasper 报告,但出现以下错误:

org/codehaus/groovy/control/CompilationFailedException in java

JRDataSource dataSource = new JREmptyDataSource(1000);

Map parameters = new HashMap();
parameters.put("id", 42);

JasperPrint jasperPrint;
try {
JasperReport report = (JasperReport) JRLoader.loadObject("C:/Users/kobinath/Documents/NetBeansProjects/payroll/src/report1.jasper");
jasperPrint = JasperFillManager.fillReport(report, parameters, dataSource);
JFrame frame = new JFrame("Report");
frame.getContentPane().add(new JRViewer(jasperPrint));
frame.pack();
frame.setVisible(true);
} catch (JRException ex) {
Logger.getLogger(emploee.class.getName()).log(Level.SEVERE, null, ex);
}

report1.jrxml enter image description here

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/codehaus/groovy/control/CompilationFailedException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructor0(Class.java:3075)
at java.lang.Class.getConstructor(Class.java:1825)
at net.sf.jasperreports.engine.JasperCompileManager.getCompiler(JasperCompileManager.java:690)
at net.sf.jasperreports.engine.JasperCompileManager.getEvaluator(JasperCompileManager.java:263)
at net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(JRFillDataset.java:457)
at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:379)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:88)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:103)

最佳答案

默认模板语言是 Groovy,因此需要依赖关系。您可以通过编辑 jasper 报告模板并从 jasperReport 节点中删除 language="groovy"属性来更改它。

关于java - java 中的 org/codehaus/groovy/control/CompilationFailedException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56490585/

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