Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Creation of reports using JasperReports

527664Oct 2 2006 — edited Oct 17 2006
Hi all!

I have a problem with developing Java code for printing reports, by using JasperReports tool.

I'm trying to create report by using next peace of code (you can found it also on http://ensode.net/jasperreports_intro.html)

package myReport;

import java.util.HashMap;
import net.sf.jasperreports.engine.JREmptyDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;

public class Sample
{
public static void main(String[] args)
{
JasperReport jasperReport;
JasperPrint jasperPrint;
try
{
jasperReport = JasperCompileManager.compileReport("c:\\report_1.jrxml");
jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), new JREmptyDataSource());
//JasperExportManager.exportReportToPdfFile(jasperPrint, "c:\\simple_report.pdf");
}
catch (JRException e)
{
e.printStackTrace();
}
}
}




I'm getting the following error:



Exception in thread main
java.lang.NoClassDefFoundError: org.apache.commons.digester.SetNestedPropertiesRule
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:202)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:167)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:151)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:142)
at myReport.Sample.main(Sample.java:20)



BTW, file report_1.jrxml I created using iReport.


Can somebody help me how to solve this, and to create my report? Always, all the time with different examples I got same errors, I guess that I done somethiong wrong on in setup, or classpath, or something like that...
Thank you in advance!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 14 2006
Added on Oct 2 2006
8 comments
5,658 views