简体   繁体   中英

Eclipse - Jasper report not compiling (java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester)

I am trying to generate a jasper report via the Eclipse ide, however when I execute the following line of code:

jasperReport = JasperCompileManager.compileReport("reports/samplereport.jrxml");

I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:146)

I have added the apache common digester jar as a project library but it does not seem to make a difference. NOTE: I am from a java novice (ie Ive a .NET background,) so I am very likely doing something really obvious!

you may be missing some jars. try to add these ones with any version.

jasperreports-.jar;
jasperreports-javaflow.jar;
commons-beanutils.jar;
commons-collections.jar;
commons-logging.jar;
commons-digester.jar

If your project is based on maven, you can add Jasper reports as a maven dependency, see sample code snippet below. Jasper report would automatically import all the libraries it needs to work properly.

...
<dependency>
    <groupId>net.sf.jasperreports</groupId>            
    <artifactId>jasperreports</artifactId>
    <version>6.4.1</version>
</dependency>
...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM