Starting with JasperReports

86

My first days at AMIS I examined JasperReports (v. 0.6.3), an open source report-generating library. This tool is entirely written in Java and uses XML report templates to generate reports you can display on the screen, send to a printer, or save as a PDF document.

In order to fill a report with data, the report design (template) must be compiled first.
This compilation is performed by the compileReport() method exposed by the net.sf.jasperreports.engine.JasperCompileManager class.
Through compilation, the report design is loaded into a report design object that is then serialized and stored on disk (net.sf.jasperreports.engine.JasperReport). This serialized object is then used when the application wants to fill the specified report design with data. In fact, the compilation of a report design implies the compilation of all Java expressions defined in the XML file representing the report design. Various verifications are made at compilation time, to check the report design consistency. The result is a ready to fill report design that will be then used to generate documents on different sets of data.

In order to fill a report design, one can use the fillReport() method exposed by the net.sf.jasperreports.engine.JasperFillManager class. This method takes as parameters:

  • the report design object, or a file representing the specified report design object, in a serialized form
  • a map of reportparameters
  • a JDBC connection to the database from where to retrieve the data to fill the report

The result is an object that represents the ready to print document (net.sf.jasperreports.engine.JasperPrint) and can be stored onto the disk, in a serialized form, for later use, or can be delivered to the printer, to the screen or can be transformed into a PDF, HTML, XLS, CSV or XML document.
I’ve only tried the PDF transformation. The following code illustrates this:

package nl.amis.jasper.test;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.view.JasperViewer;
import nl.amis.database.Database;

public class EmpDeptReport {

        public static void main(String[] args) {
//                 First, load JasperDesign from XML and compile it into JasperReport
                try {
                        JasperDesign jasperDesign = JRXmlLoader.load("EmpDeptReport.xml");
                        JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);

//                 Second, create a map of parameters to pass to the report.
                        Map parameters = new HashMap();
                        parameters.put("Title", "EmpDept JasperReport");

//                 Third, get a database connection
                         Connection conn = Database.getConnection();

//                 Fourth, create JasperPrint using fillReport() method
                        JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
                                           parameters, conn);

//                 You can use JasperPrint to create PDF
                        JasperExportManager.exportReportToPdfFile(jasperPrint, "EmpDeptReport.pdf");

//                 Or to view report in the JasperViewer
                        JasperViewer.viewReport(jasperPrint);
                } catch (JRException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (SQLException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
        }
}

To create a XML report template I’ve used OpenReports Designer (v. 1.10).
This is a tool that combines a visual report designer, an XML report definition editor, and report viewer into one interface to provide a complete integrated report development environment.

The XML file EmpDeptReport.xml – which can be downloaded below – is a template for a report which retrieves data from Oracle’s Emp and Dept tables.
In the following I’ll explain the structure of this template. This structure is declared in a DTD file supplied with the JasperReports engine.

Every JasperReports XML template starts with with the following structure:

< ?xml version="1.0" encoding="UTF-8"?>
< !DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
< jasperReport name="EmpDeptReport" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30">

< /jasperReport>

Parameters are object references that are passed-in to the report filling operations (see EmpDeptReport class above).
Declaring a parameter in a report design is very simple and it requires specifying only its name and its class:

< parameter name=”Title” class=”java.lang.String”>
< /parameter>

When using a JDBC data source, one could pass a Connection object to the report filling operations (see also EmpDeptReport class) and specify the query in the report definition itself:

&lt; queryString&gt; &lt; ![CDATA[select e.empno
                                       , e.ename
                                       , e.job
                                       , e.mgr
                                       , to_char(e.hiredate, 'dd-mm-yyyy') hiredate
                                       , e.sal
                                       , e.comm
                                       , e.deptno
                                       , d.dname
                                       , d.loc
                                  from emp e
                                  ,    dept d
                                  where e.deptno = d.deptno
                                  order by e.deptno]]&gt; &lt; /queryString&gt;

Report fields represent the only way to map data from the data source into the report generating routines.
We can define the following field in our report design:

&lt; field name="ENAME" class="java.lang.String"&gt;
&lt; /field&gt;

Expressions are a powerful feature of JasperReports. They can be used for declaring report variables that perform various calculations, for data grouping on the report, to specify report text fields content or to further customize the appearance of objects on the report.
Basically, all report expressions are Java expressions that can reference report fields and report variables.
In an XML report design there are several elements that define expressions: < variableExpression> , < initialValueExpression> , < groupExpression> , < printWhenExpression> , < imageExpression> and < textFieldExpression> .
In order to use a report field reference in an expression, the name of the field must be put between $F{ and } character sequences.

A Report variable is a special objects build on top of an expression. Variables can be used to simplify the report design by declaring only once an expression that is heavily used throughout the report design or to perform various calculations on the corresponding expressions.
Variables can perform built-in types of calculations on their corresponding expression values like: count, sum, average, lowest, highest, variance, etc.

A variable that performs the sum of the SAL field per department should be declared like this:

&lt; variable name="SalSumDept" class="java.math.BigDecimal" resetType="Group" resetGroup="DeptGroup" calculation="Sum"&gt;
                &lt; variableExpression&gt; &lt; ![CDATA[$F{SAL}]]&gt; &lt; /variableExpression&gt;
&lt; /variable&gt;

As you can see a group DeptGroup is introduced.
Groups represent a flexible way to organize data on a report. When filling a report, the JasperReports engine test all the defined group expressions to see whether a group rupture has occurred and if so it introduces the corresponding < groupFooter> and < groupHeader> sections on the report:

&lt; group name="DeptGroup"&gt;
        &lt; groupExpression&gt; &lt; ![CDATA[$F{DEPTNO}]]&gt; &lt; /groupExpression&gt;
        &lt; groupHeader&gt;

        &lt; /groupHeader&gt;
        &lt; groupFooter&gt;

        &lt; /groupFooter&gt;
&lt; /group&gt;

By the the way, I didn’t succeed in creating groupHeaders and groupFooters with OpenReports Designer (v. 1.10), so I did some copy-paste from another template.

The template’s remainder divides into six report sections:

  • title
  • pageHeader
  • columnHeader
  • detail
  • columnFooter
  • pageFooter
  • summary

Each report section, called a band, is given a height. Each band can include multiple staticText and textField elements, which are given a position, size, and value. Report parameters, fields, and variables are referenced using P${name}, F${name}, and V${name}, respectively.

For example, the following lines in the page footer section create a staticText and a textField containing the current page number. The page number’s value is set to the variable PAGE_NUMBER, defined internally by JasperReports and available to all reports:

&lt; pageFooter&gt;
        &lt; band height="15"&gt;
                &lt; staticText&gt;
                        &lt; reportElement positionType="Float" x="0" y="0" width="40"
                         height="15"/&gt;
                        &lt; textElement/&gt;
                        &lt; text&gt; &lt; ![CDATA[Page:]]&gt; &lt; /text&gt;
                &lt; /staticText&gt;
                &lt; textField&gt;
                        &lt; reportElement positionType="Float" x="40" y="0" width="100"
                          height="15"/&gt;
                        &lt; textElement/&gt;
                        &lt; textFieldExpression="java.lang.Integer"&gt; &lt; ![CDATA[$V{PAGE_NUMBER}]]
                  &gt;
                        &lt; /textFieldExpression&gt;
                &lt; /textField&gt;
        &lt; /band&gt;
&lt; /pageFooter&gt;

Resources:
‘Reports made easy with JasperReports’ by Erik Swenson:
http://www.javaworld.com/javaworld/jw-09-2002/jw-0920-opensourceprofile.html

Find the JasperReports homepage at:
http://jasperreports.sourceforge.net

OpenReports Project:
http://opensourcesoft.net

Report design tools for Eclipse:
http://sourceforge.net/projects/jeez (this plugin doesn’t seem to work with Eclipse 3.0.1)

Downloads:
EmpDeptReport.java
Database.java
EmpDeptReport.xml

Share.

About Author

86 Comments

  1. Pingback: Jessie

  2. Pingback: bi polar, bi polar disorders, bi polar disorder, manic depression

  3. Pingback: bi polar, bi polar disorders, bi polar disorder, manic depression

  4. I am in reset
    Apr 12, 2007 6:19:34 PM org.apache.struts.util.PropertyMessageResources loadLocale
    WARNING: Resource Mypack/ApplicationResources_en_US.properties Not Found.
    Apr 12, 2007 6:19:34 PM org.apache.struts.util.PropertyMessageResources loadLocale
    WARNING: Resource Mypack/ApplicationResources_en.properties Not Found.
    Apr 12, 2007 6:19:41 PM org.apache.struts.tiles.TilesRequestProcessor initDefinitionsMapping
    INFO: Tiles definition factory found for request processor ”.
    I am in reset
    I am in Validate
    I am in insert
    Lord Shiva
    one
    two
    jre exceptionnet.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
    C:\Eclipse\BasicReport_1176382183312_296351.java:4: package net.sf.jasperreports.engine does not exist
    import net.sf.jasperreports.engine.*;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:5: package net.sf.jasperreports.engine.fill does not exist
    import net.sf.jasperreports.engine.fill.*;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:18: cannot resolve symbol
    symbol : class JREvaluator
    location: class BasicReport_1176382183312_296351
    public class BasicReport_1176382183312_296351 extends JREvaluator
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:25: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    private JRFillParameter parameter_REPORT_RESOURCE_BUNDLE = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:26: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    private JRFillParameter parameter_REPORT_CLASS_LOADER = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:27: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    private JRFillParameter parameter_REPORT_FORMAT_FACTORY = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:28: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    private JRFillParameter parameter_REPORT_TIME_ZONE = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:29: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    private JRFillParameter parameter_REPORT_DATA_SOURCE = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:30: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    private JRFillParameter parameter_REPORT_LOCALE = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:31: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    private JRFillParameter parameter_REPORT_URL_HANDLER_FACTORY = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:32: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    private JRFillParameter parameter_REPORT_PARAMETERS_MAP = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:33: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    private JRFillParameter parameter_REPORT_CONNECTION = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:34: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    private JRFillParameter parameter_IS_IGNORE_PAGINATION = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:35: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    private JRFillParameter parameter_REPORT_VIRTUALIZER = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:36: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    private JRFillParameter parameter_Title = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:37: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    private JRFillParameter parameter_REPORT_SCRIPTLET = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:38: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    private JRFillParameter parameter_REPORT_MAX_COUNT = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:39: cannot resolve symbol
    symbol : class JRFillField
    location: class BasicReport_1176382183312_296351
    private JRFillField field_EMPNO = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:40: cannot resolve symbol
    symbol : class JRFillField
    location: class BasicReport_1176382183312_296351
    private JRFillField field_EMPNAME = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:41: cannot resolve symbol
    symbol : class JRFillVariable
    location: class BasicReport_1176382183312_296351
    private JRFillVariable variable_PAGE_NUMBER = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:42: cannot resolve symbol
    symbol : class JRFillVariable
    location: class BasicReport_1176382183312_296351
    private JRFillVariable variable_COLUMN_NUMBER = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:43: cannot resolve symbol
    symbol : class JRFillVariable
    location: class BasicReport_1176382183312_296351
    private JRFillVariable variable_REPORT_COUNT = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:44: cannot resolve symbol
    symbol : class JRFillVariable
    location: class BasicReport_1176382183312_296351
    private JRFillVariable variable_PAGE_COUNT = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:45: cannot resolve symbol
    symbol : class JRFillVariable
    location: class BasicReport_1176382183312_296351
    private JRFillVariable variable_COLUMN_COUNT = null;
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:68: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    parameter_REPORT_RESOURCE_BUNDLE = (JRFillParameter)pm.get(“REPORT_RESOURCE_BUNDLE”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:69: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    parameter_REPORT_CLASS_LOADER = (JRFillParameter)pm.get(“REPORT_CLASS_LOADER”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:70: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    parameter_REPORT_FORMAT_FACTORY = (JRFillParameter)pm.get(“REPORT_FORMAT_FACTORY”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:71: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    parameter_REPORT_TIME_ZONE = (JRFillParameter)pm.get(“REPORT_TIME_ZONE”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:72: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    parameter_REPORT_DATA_SOURCE = (JRFillParameter)pm.get(“REPORT_DATA_SOURCE”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:73: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    parameter_REPORT_LOCALE = (JRFillParameter)pm.get(“REPORT_LOCALE”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:74: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    parameter_REPORT_URL_HANDLER_FACTORY = (JRFillParameter)pm.get(“REPORT_URL_HANDLER_FACTORY”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:75: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    parameter_REPORT_PARAMETERS_MAP = (JRFillParameter)pm.get(“REPORT_PARAMETERS_MAP”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:76: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    parameter_REPORT_CONNECTION = (JRFillParameter)pm.get(“REPORT_CONNECTION”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:77: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    parameter_IS_IGNORE_PAGINATION = (JRFillParameter)pm.get(“IS_IGNORE_PAGINATION”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:78: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    parameter_REPORT_VIRTUALIZER = (JRFillParameter)pm.get(“REPORT_VIRTUALIZER”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:79: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    parameter_Title = (JRFillParameter)pm.get(“Title”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:80: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    parameter_REPORT_SCRIPTLET = (JRFillParameter)pm.get(“REPORT_SCRIPTLET”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:81: cannot resolve symbol
    symbol : class JRFillParameter
    location: class BasicReport_1176382183312_296351
    parameter_REPORT_MAX_COUNT = (JRFillParameter)pm.get(“REPORT_MAX_COUNT”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:90: cannot resolve symbol
    symbol : class JRFillField
    location: class BasicReport_1176382183312_296351
    field_EMPNO = (JRFillField)fm.get(“EMPNO”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:91: cannot resolve symbol
    symbol : class JRFillField
    location: class BasicReport_1176382183312_296351
    field_EMPNAME = (JRFillField)fm.get(“EMPNAME”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:100: cannot resolve symbol
    symbol : class JRFillVariable
    location: class BasicReport_1176382183312_296351
    variable_PAGE_NUMBER = (JRFillVariable)vm.get(“PAGE_NUMBER”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:101: cannot resolve symbol
    symbol : class JRFillVariable
    location: class BasicReport_1176382183312_296351
    variable_COLUMN_NUMBER = (JRFillVariable)vm.get(“COLUMN_NUMBER”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:102: cannot resolve symbol
    symbol : class JRFillVariable
    location: class BasicReport_1176382183312_296351
    variable_REPORT_COUNT = (JRFillVariable)vm.get(“REPORT_COUNT”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:103: cannot resolve symbol
    symbol : class JRFillVariable
    location: class BasicReport_1176382183312_296351
    variable_PAGE_COUNT = (JRFillVariable)vm.get(“PAGE_COUNT”);
    ^
    C:\Eclipse\BasicReport_1176382183312_296351.java:104: cannot resolve symbol
    symbol : class JRFillVariable
    location: class BasicReport_1176382183312_296351
    variable_COLUMN_COUNT = (JRFillVariable)vm.get(“COLUMN_COUNT”);
    ^
    45 errors

    end

    I am getting this error messages when trying to jasper report in struts.
    please help me. I can create jasper report at standalone application

  5. Re: “URI was not reported to parser for entity [document]”

    The reason is “gnujaxp.jar”. Nowadays it should be safe to remove it from the CLASSPATH This drove me crazy all afernoon… Who has the patience to read (I’m not among those) will notice the “gnu.xml.aelfred2…” in the stack trace:

    Caused by: org.xml.sax.SAXParseException: URI was not reported to parser for entity [document]
    at gnu.xml.aelfred2.SAXDriver.warn(SAXDriver.java:934)

  6. Hi,

    I want to generate dynamic reports using Jasper from JSF. I want to know is it possible. If yes, where can i find the simple example of the same.

    Please Reply,

    Thanks,
    Ashok.

  7. am using iReport 1.5.2
    My table is as like
    Date warehouse delivery No
    7/7/2006 10 10-1
    7/7/2006 20 20-1
    7/7/2006 20 20-2
    7/7/2006 30 30-1
    8/7/2006 10 10-2
    8/7/2006 10 10-3
    11/7/2006 30 30-2
    11/7/2006 20 20-3

    I want Output will be as like
    Date WH10 WH20 WH30 total delivery
    7/7/2006 1 2 1 4
    8/7/2006 2 0 0 2
    11/7/2006 1 1 0 2

    I can’t use crosstab in iReport
    Pls send me the steps of crosstab……..by which I can create this report
    what should I do????
    Please help……
    Thanks
    Mainur rahman

  8. I am using iReport 1.5.2
    My table is as like
    Date warehouse delivery No
    7/7/2006 10 10-1
    7/7/2006 20 20-1
    7/7/2006 20 20-2
    7/7/2006 30 30-1
    8/7/2006 10 10-2
    8/7/2006 10 10-3
    11/7/2006 30 10 30-2
    11/7/2006 20 20 20-3

    I want Output will be as like
    Date WH10 WH20 WH30 total delivery
    7/7/2006 1 2 1 4
    8/7/2006 2 0 0 2
    11/7/2006 1 1 0 2

    I can’t use crosstab in iReport
    Pls send me the steps of crosstab……..by which I can create this report
    what should I do????
    Please help……
    Thanks
    Mainur rahman

  9. Hello!,

    I am new Jasper Report. I want to create report from retrieving data from MS ACCESS.My table name is Employee and field are ID,Name,Address,Phone. Actually I want to generete report for these details. so please send the whole program (.jxml file , java full file).Because i am entirely new to Jasper Reports.

    Thanks & Regards,
    Suresh

  10. Hello everyone!!
    Im new to JasperReports im using Eclipse and JasperAssistant…
    This has been my problem almost a week can someone help me please..

    This is my code…

    public class SampleJasper {

    /** Creates a new instance of JasperReports */

    public static void main(String[] args){
    String reportSource = “src/domainObj/jasperReports.jrxml”;
    //String reportDest = “HelloReportWorld.html”;

    Map params = new HashMap();

    try {
    JasperReport jasperReport =
    JasperCompileManager.compileReport(reportSource);

    JasperPrint jasperPrint =
    JasperFillManager.fillReport(
    jasperReport, params, new JREmptyDataSource());

    // JasperExportManager.exportReportToHtmlFile(
    // jasperPrint, reportDest);

    JasperViewer.viewReport(jasperPrint);
    }

    catch (JRException ex) {
    ex.printStackTrace();
    }
    }
    }

    java.io.IOException: CreateProcess: javac -classpath “E:\myprogramming\myWorkSpacesEcclipse\JasperReport\Jasper\bin;C:\Program Files\JasperSoft\iReport-1.2.6\lib\commons-javaflow-20060411.jar;C:\Program Files\JasperSoft\iReport-1.2.6\lib\commons-logging-1.0.2.jar;C:\Program Files\JasperSoft\iReport-1.2.6\lib\ireport.jar;C:\Program Files\JasperSoft\iReport-1.2.6\lib\itext-1.3.1.jar;C:\Program Files\JasperSoft\iReport-1.2.6\lib\jasperreports-1.2.6.jar;C:\Program Files\JasperSoft\iReport-1.2.6\lib\commons-beanutils-1.5.jar;C:\Program Files\JasperSoft\iReport-1.2.6\lib\commons-collections-2.1.jar;C:\Program Files\JasperSoft\iReport-1.2.6\lib\commons-dbcp-1.2.1.jar;C:\Program Files\JasperSoft\iReport-1.2.6\lib\commons-digester-1.7.jar” E:\myprogramming\myWorkSpacesEcclipse\JasperReport\Jasper\jasperReports_1159932575375_734464.java error=2
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.(Unknown Source)
    at java.lang.ProcessImpl.start(Unknown Source)
    at java.lang.ProcessBuilder.start(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:62)
    at net.sf.jasperreports.engine.design.JRAbstractClassCompiler.compileUnits(JRAbstractClassCompiler.java:67)
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:190)
    at net.sf.jasperreports.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:105)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:211)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:144)
    at domainObj.SampleJasper.main(SampleJasper.java:39)

    NESTED BY :
    java.io.IOException: CreateProcess: javac -classpath “E:\myprogramming\myWorkSpacesEcclipse\JasperReport\Jasper\bin;C:\Program Files\JasperSoft\iReport-1.2.6\lib\commons-javaflow-20060411.jar;C:\Program Files\JasperSoft\iReport-1.2.6\lib\commons-logging-1.0.2.jar;C:\Program Files\JasperSoft\iReport-1.2.6\lib\ireport.jar;C:\Program Files\JasperSoft\iReport-1.2.6\lib\itext-1.3.1.jar;C:\Program Files\JasperSoft\iReport-1.2.6\lib\jasperreports-1.2.6.jar;C:\Program Files\JasperSoft\iReport-1.2.6\lib\commons-beanutils-1.5.jar;C:\Program Files\JasperSoft\iReport-1.2.6\lib\commons-collections-2.1.jar;C:\Program Files\JasperSoft\iReport-1.2.6\lib\commons-dbcp-1.2.1.jar;C:\Program Files\JasperSoft\iReport-1.2.6\lib\commons-digester-1.7.jar” E:\myprogramming\myWorkSpacesEcclipse\JasperReport\Jasper\jasperReports_1159932575375_734464.java error=2
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.(Unknown Source)
    at java.lang.ProcessImpl.start(Unknown Source)
    at java.lang.ProcessBuilder.start(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:62)
    at net.sf.jasperreports.engine.design.JRAbstractClassCompiler.compileUnits(JRAbstractClassCompiler.java:67)
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:190)
    at net.sf.jasperreports.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:105)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:211)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:144)
    at domainObj.SampleJasper.main(SampleJasper.java:39)

    NESTED BY :
    net.sf.jasperreports.engine.JRException: Error compiling report java source files : E:\myprogramming\myWorkSpacesEcclipse\JasperReport\Jasper\jasperReports_1159932575375_734464.java
    at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:93)
    at net.sf.jasperreports.engine.design.JRAbstractClassCompiler.compileUnits(JRAbstractClassCompiler.java:67)
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:190)
    at net.sf.jasperreports.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:105)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:211)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:144)
    at domainObj.SampleJasper.main(SampleJasper.java:39)

    ………..

    Thanks everyone…
    I just need a sample project that works well…
    visual_vsherk@yahoo.com

  11. i’m using iReport editor. i have done one database using iReport now wat the problem is while i write java code using Eclipse only ireport form displays null fields from database. so how can i display my values using java code otherwise wat i have to do? anybody know answer for my question means pls send code to my email-id. thanks

  12. Hi,
    I am able to run jasper report in Tomcat Web Server.
    But I got two problems:

    1. The report is oppening using jasper viewer. But when i cancel the report viewer my Tomcat server also stopped without giving any errors.

    2. I want to view my jasper report in pdf format on my client machine. But when i am trying to open it from client machine the report viewer is executing on server.

    Please help.
    Thanks and Regards,
    Utsav

  13. Hi Allan,
    Put all of the Jasper Jars in the jboss-4.0.1\server\default\lib dir. To start jboss fire following command -
    “run -Djasper.reports.compile.class.path=>”

    Let me know in case of any concerns or issue.

    Regards,
    Alok Saha.

  14. Hi, pls help me, i am also using jasperreports. i already put all the required jar files in the classpath, i can compile my program successfully but when i execute it , it gives me the ff error:

    05-Aug-2006 15:24:07 org.apache.commons.digester.Digester warning
    WARNING: Parse Warning Error at line 1 column 0: URI was not reported to parser
    for entity [document]
    org.xml.sax.SAXParseException: URI was not reported to parser for entity [docume
    nt]
    at gnu.xml.aelfred2.SAXDriver.warn(SAXDriver.java:934)
    at gnu.xml.aelfred2.SAXDriver.startExternalEntity(SAXDriver.java:631)
    at gnu.xml.aelfred2.XmlParser.pushURL(XmlParser.java:3358)
    at gnu.xml.aelfred2.XmlParser.doParse(XmlParser.java:159)
    at gnu.xml.aelfred2.SAXDriver.parse(SAXDriver.java:320)
    at gnu.xml.aelfred2.XmlReader.parse(XmlReader.java:294)
    at org.apache.commons.digester.Digester.parse(Digester.java:1647)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:
    238)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:
    225)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:213
    )
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:167
    )
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:151
    )
    at TestJasper.runReport(TestJasper.java:71)
    at TestJasper.main(TestJasper.java:100)
    Could not create the report URI was not reported to parser for entity [document]
    URI was not reported to parser for entity [document]
    Press any key to continue…

  15. Delia Montoya Casas on

    Hi, I copy and paste the example code, and I have all jars in my path. My compilation es well but in the moment execution says this:

    Hola mundo desde este Web1
    Error here logpath = D:/mediacion/Resources/MySpace
    conn=oracle.jdbc.driver.OracleConnection@18f6235
    java.io.FileNotFoundException: EmpDeptReport.xml (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.(FileInputStream.java:106)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:166)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:151)
    at org.sime.jasper.CreaPDF.startReporte(CreaPDF.java:118)
    at org.sime.Main.main(Main.java:31)

    NESTED BY :
    java.io.FileNotFoundException: EmpDeptReport.xml (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.(FileInputStream.java:106)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:166)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:151)
    at org.sime.jasper.CreaPDF.startReporte(CreaPDF.java:118)
    at org.sime.Main.main(Main.java:31)

    NESTED BY :
    net.sf.jasperreports.engine.JRException: EmpDeptReport.xml (The system cannot find the file specified)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:171)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:151)
    at org.sime.jasper.CreaPDF.startReporte(CreaPDF.java:118)
    at org.sime.Main.main(Main.java:31)
    Caused by: java.io.FileNotFoundException: EmpDeptReport.xml (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.(FileInputStream.java:106)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:166)
    … 3 more

    and my java code is this.

    package org.sime.db;

    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.util.Properties;

    import org.sime.helper.Logger;

    import com.sun.corba.se.pept.transport.Connection;

    public class DBOracle {
    private Logger log;
    private String dbUser;
    private String dbPwd;
    private static final String ORACLEDRIVER = “oracle.jdbc.driver.OracleDriver”;
    private String oracleUrl = “jdbc:oracle:thin:@”;

    public DBOracle(final Properties iprops, final Logger ilog) {
    this.dbUser = iprops.getProperty(“dbuser”);
    this.dbPwd = iprops.getProperty(“dbpwd”);
    this.oracleUrl += iprops.getProperty(“dbip”);
    this.oracleUrl += “:”;
    this.oracleUrl += iprops.getProperty(“dbport”);
    this.oracleUrl += “:”;
    this.oracleUrl += iprops.getProperty(“dbinstance”);
    this.log = ilog;
    }

    public final java.sql.Connection getConn() {
    java.sql.Connection conn = null;
    try {
    Class.forName(ORACLEDRIVER);
    conn = DriverManager.getConnection(this.oracleUrl, this.dbUser, this.dbPwd);
    } catch (ClassNotFoundException cnfe) {
    Logger.write(“DbProvider”, “ERR”, “Class Not Found: ” + ORACLEDRIVER);

    } catch (SQLException sqle) {
    Logger.write(“DbProvider”, “ERR”,”Unable to connect to database server”);
    }
    return conn;
    }
    public final void cerrar (Connection conn) throws SQLException{
    if (conn != null) {
    conn.close();
    conn = null;
    }
    }
    }

    package org.sime.jasper;

    import java.sql.Connection;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.Properties;

    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;

    import net.sf.jasperreports.engine.design.JasperDesign;
    import net.sf.jasperreports.engine.xml.JRXmlLoader;
    import net.sf.jasperreports.view.JasperViewer;

    import org.sime.db.DBOracle;
    import org.sime.helper.Logger;

    public class CreaPDF {
    DBOracle db ;
    Properties iprops;
    Logger logger;
    Connection conn;

    public CreaPDF(Properties iprops, Logger logger){
    this.iprops=iprops;
    this.logger=logger;
    db = new DBOracle(iprops,logger);
    conn= db.getConn();
    System.out.println(“conn=”+conn);
    }
    public boolean startReporte(){

    // First, load JasperDesign from XML and compile it into JasperReport
    try {
    JasperDesign jasperDesign = JRXmlLoader.load(“EmpDeptReport.xml”);
    JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);

    // Second, create a map of parameters to pass to the report.
    Map parameters = new HashMap();
    parameters.put(“Title”, “EmpDept JasperReport”);

    // Third, get a database connection
    // Connection conn = Database.getConnection();

    // Fourth, create JasperPrint using fillReport() method
    JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
    parameters, conn);

    JasperExportManager.exportReportToPdfFile(jasperPrint, “EmpDeptReport.pdf”);

    JasperViewer.viewReport(jasperPrint);
    } catch (JRException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

    return true;
    }
    }

  16. dear all,
    i have some problem when i executing the JR:

    javax.servlet.ServletException: Servlet execution threw an exception
    org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
    org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    com.mnp.utility.NoCacheFilter.doFilter(NoCacheFilter.java:91)

    root cause

    java.lang.NoClassDefFoundError: com/lowagie/text/DocumentException
    net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfStream(JasperExportManager.java:162)
    com.mnp.report.ReportJR.doPost(ReportJR.java:140)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
    org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    com.mnp.utility.NoCacheFilter.doFilter(NoCacheFilter.java:91)

    Any help over this

    Thanks in advance

  17. How to generating online reports using JasperReports and WebSphere Studio if i need to show different colunms of a report depending on a criteria such as user selections. please show code for create them ,thanks bum

  18. I need help. We are building a Web application using J2EE technology we are using Oracle JDeveloper 10g. I’ve developed a report using iReport 1.2.2 it requires four parameters.

    How do I call the report from the jsp page in our application

  19. This article excellent and I was able to run the application by fixing all the errors whose solutions were specified in this article.

  20. Hi all.

    I can’t to run JasperReport on WebSphere 5.0.X.
    I made a servlet as follow:

    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.io.StringWriter;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;

    import javax.servlet.Servlet;
    import javax.servlet.ServletException;
    import javax.servlet.ServletOutputStream;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    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;
    import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;

    public class Myservlet extends HttpServlet implements Servlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {

    ServletOutputStream servletOutputStream = response.getOutputStream();

    File reportFile = new File(“d:/temp/report1.jrxml”);

    List collection = new ArrayList();

    collection.add(new Empregado(Integer.toString(1), Integer.toString(1)));

    byte[] bytes = null;

    try {
    System.setProperty(“jasper.reports.compile.class.path”, getServletConfig().getServletContext().getRealPath(“/WEB-INF/lib/jasperreports-1.2.0.jar”));

    JasperReport jasperReport = JasperCompileManager.compileReport(new FileInputStream(reportFile));

    JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), new JRBeanCollectionDataSource(collection));

    bytes = JasperExportManager.exportReportToPdf(jasperPrint);

    response.setContentType(“application/pdf”);
    response.setContentLength(bytes.length);

    servletOutputStream.write(bytes, 0, bytes.length);

    servletOutputStream.flush();
    servletOutputStream.close();

    } catch (JRException e) {
    e.printStackTrace();
    }

    }

    }

    The webapp “freeze” after I call that servlet and don’t report any error.
    This happens in:

    bytes = JasperExportManager.exportReportToPdf(jasperPrint);

    Does anybody help me?

    Sorry for my poor english.

    Luiz Mendes Almeida

  21. Iam Getting the same error …

    My class path gettings are like below…. Even after setting this also iam getting the same error .. iam using weblogic Application server……

    System.setProperty(“jasper.reports.compile.class.path”,
    context.getRealPath(“/WEB-INF/lib/jasperreports-0.6.1.jar”) +
    System.getProperty(“path.separator”) +
    context.getRealPath(“/WEB-INF/classes/”));

    opt/WebSphere/AppServer/informe1.java:4: package net.sf.jasperreports.engine does not exist
    import net.sf.jasperreports.engine.*;
    ^
    /opt/WebSphere/AppServer/informe1.java:5: package net.sf.jasperreports.engine.fill does not exist
    import net.sf.jasperreports.engine.fill.*;
    ^
    /opt/WebSphere/AppServer/informe1.java:14: package net.sf.jasperreports.engine does not exist
    import net.sf.jasperreports.engine.*;
    ^
    /opt/WebSphere/AppServer/informe1.java:15: package net.sf.jasperreports.engine.data does not exist
    import net.sf.jasperreports.engine.data.*;
    ^
    /opt/WebSphere/AppServer/informe1.java:21: cannot resolve symbol
    symbol : class JRCalculator
    location: class informe1
    public class informe1 extends JRCalculator
    ^
    ……………………….

    AIm using commons-digester-1.3 .. version….

    Any help over this

    Thanks in advance

  22. Hi dude!!!
    You simply have to put newer version of common-digester.jar in your classpath or project class´path.
    This method only exists in this version.
    Grettings.

  23. hii,
    I got the following errors..

    org.apache.commons.digester.Digester endElement
    SEVERE: End event threw error
    java.lang.NoClassDefFoundError: org/apache/commons/beanutils/MethodUtils
    at org.apache.commons.digester.CallMethodRule.end(CallMethodRule.java:625)
    at org.apache.commons.digester.Rule.end(Rule.java:230)
    at org.apache.commons.digester.Digester.endElement(Digester.java:1130)
    at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1720)
    at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
    at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:667)
    at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
    at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
    at org.apache.commons.digester.Digester.parse(Digester.java:1647)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:238)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:225)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:213)
    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.JasperManager.loadXmlDesign(JasperManager.java:971)
    at Reports.(Reports.java:54)
    at Reports.main(Reports.java:79)
    java.lang.NoClassDefFoundError: org/apache/commons/beanutils/MethodUtils
    at org.apache.commons.digester.CallMethodRule.end(CallMethodRule.java:625)
    at org.apache.commons.digester.Rule.end(Rule.java:230)
    at org.apache.commons.digester.Digester.endElement(Digester.java:1130)
    at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1720)
    at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
    at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:667)
    at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
    at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
    at org.apache.commons.digester.Digester.parse(Digester.java:1647)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:238)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:225)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:213)
    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.JasperManager.loadXmlDesign(JasperManager.java:971)
    at Reports.(Reports.java:54)
    at Reports.main(Reports.java:79)
    Exception in thread “main”

    Any suggestions ???

  24. I also had: Exception in thread “main� java.lang.NoClassDefFoundError: org/apache/commons/di
    gester/SetNestedPropertiesRule.

    I was using jasperreports-1.1.1.jar but I reverted back to jasperreports-0.6.8.jar which seems to have solved this problem.

  25. Hello

    I am a beginner to Jasper reports, I successfully completed compilation,
    when I am trying to run the following exeception occured.

    Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/commons/di
    gester/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(Jasper
    CompileManager.java:142)
    at JasperReportsIntro.main(JasperReportsIntro.java:18)
    Any ideas ?

  26. Hi, I keep getting:

    Error: Error compiling report java source file : X:\WindTunnel\JasperReporter\EmpDeptReport.java
    if I try & run the tutorial. I have the java file in a subfolder: X:\WindTunnel\src, but even if I copy the file in the required location, it doesn’t work. Gives me the same error AND deletes the file!!!

    Any ideas?

  27. This is an compability between jars for report
    Remove xerces, xmlParseApi.jar wil be helpfull for solving problems..

  28. Hi to everybody and thanks a lot for ur heÅŸps
    i use eclipse 3.0 with jbosside jboss4.0.2 and i have a problem with jasperreports
    1-while i was using jdev, there was no problem. i carry the project with needed package under eclipse i have gotten problems
    2-While i call jasperreports from jsp i get the exception below
    11:55:50,252 ERROR [Digester] Body event threw exception
    java.lang.ClassCastException
    at org.apache.commons.digester.SetNestedPropertiesRule.body(SetNestedPropertiesRule.java:261)
    at org.apache.commons.digester.Digester.endElement(Digester.java:1006)
    at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)

  29. Ragunatha Reddy Kummetha on

    Hi

    I am using iReport to generate a report templete and integrated the same in a web application. My problem is everything works as expected in my local machine. I am using Jdeveloper10.1.3 and the application works fine on OC4J but when I deploy it on the application server , I am getting the following
    Error: Please Help

    500 Internal Server Error
    java.lang.NullPointerException at org.apache.commons.digester.Digester.getXMLReader(Digester.java:899) at org.apache.commons.digester.Digester.parse(Digester.java:1647) at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:238) at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:225) at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:213) 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.compileReportToFile(JasperCompileManager.java:81) at _jsp._CompileReports._jspService(_CompileReports.java:62) [SRC:/jsp/CompileReports.jsp:19] at com.orionserver[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].http.OrionHttpJspPage.service(OrionHttpJspPage.java:56) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:347) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:208) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:125) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192) at java.lang.Thread.run(Thread.java:534)

  30. hi,
    This example is good for beginner.thanks for giving this example,but how to generate reports by using servlets,if any one knows please give solution,i awould be very thankful if u gave solution.
    regards,
    jaya.

  31. Hey, thanks for your site, so useful information.

    I’m trying to work in the detail section of a jasper report. one of the fields that I’m pulling out of dataset is a java.util.Map. The value that I am trying to get at is an the object inside the map (let’s call it StudentName). I know I have pulled back the map correctly, but any variable I have that I try to initailize to the object comes up null. Any thoughts on how you could do this?

  32. Thanks much, especially to kRESTAURANT. Finally got a report working using no XML file for the design, like in the samples. As to soumak’s question, the report fillers take a Map of parameters. Put the parameter in there, and add the parameter to your report’s query string like this: $P!{paramName}

  33. Hi,

    some of you asked: Exception in thread “mainâ€? java.lang.InternalError: Can’t connect to X11 window server using ‘:0.0′ as the value of the DISPLAY variable…

    Try to start appserver with: -Djava.awt.headless=true

    It should help.

  34. I have tried out all the variations they work otu fine. I have however not found anyway about how
    I can take user input (from a jsp page) into the query string (in the Report query field) that retrives results from the database to display it in the
    jasperreport.
    If you can suggest me any other roundabout way of achieving this. I am a developer.

  35. Hello,
    I tried to compile ur code but i got an error that states xception in thread “main” java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester at nl.amis.database.EmpDeptReport.main(EmpDeptReport.java:32 which means there is a problem at JasperDesign jasperDesign = JRXmlLoader.load(“EmpDeptReport.xml”);

  36. i all i m try to using jasper reports but i don’t have net.sf.jasperreports
    package please tell me how i get or dowload it?

  37. i have created a report but i want to display in an applicatioin but
    This is a great resource to expecially beginners like me.
    i get a ClassNOtFoundException at the
    JasperDesign jasperDesign = JXMLLoader.load(“EmpDeptReport.xml”); line.
    I beed help what the cause is and how to solve this provblem. thanks
    Henry

  38. When you compile report design, you also need jdt-compiler.jar.
    If the jar file is not included in the classpath, you will get
    the misleading message:
    package net.sf.jasperreports.engine does not exist

  39. I’ve got this error when i try to run my java file
    java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester

    at testing.xmltesting.main(xmltesting.java:61)

    i was try to send the parameter to the report n my
    coding is exactly as u are above..but when i try to load the xml file its came out
    an error like i mention u above.

    JasperDesign jdesign= JRXmlLoader.load(“c://kppReport.xml”);

    mm..should i put the xml file to the specific location or i can put it anywhere
    i this case i put it in c location.

  40. Hello!

    you should put in your class file that try to generate the report:
    System.setProperty(“jasper.reports.compile.class.path”,jasperjarfiledirectory);

    because the jasper reports that compile the jasper file is relate to the path of execute or main jar of server instance
    so it does not know to use the WEB-INF/lib directory…

    Netanel

  41. Hello,

    I have a EAR deployed in WebSphere. I’m using jasper report in this application. When I try to see the reports I get the next error:

    /opt/WebSphere/AppServer/informe1.java:4: package net.sf.jasperreports.engine does not exist
    import net.sf.jasperreports.engine.*;
    ^
    /opt/WebSphere/AppServer/informe1.java:5: package net.sf.jasperreports.engine.fill does not exist
    import net.sf.jasperreports.engine.fill.*;
    ^
    /opt/WebSphere/AppServer/informe1.java:14: package net.sf.jasperreports.engine does not exist
    import net.sf.jasperreports.engine.*;
    ^
    /opt/WebSphere/AppServer/informe1.java:15: package net.sf.jasperreports.engine.data does not exist
    import net.sf.jasperreports.engine.data.*;
    ^
    /opt/WebSphere/AppServer/informe1.java:21: cannot resolve symbol
    symbol : class JRCalculator
    location: class informe1
    public class informe1 extends JRCalculator
    ^
    /opt/WebSphere/AppServer/informe1.java:28: cannot resolve symbol
    symbol : class JRFillParameter
    location: class informe1
    private JRFillParameter parameter_fecha_final = null;
    ^
    /opt/WebSphere/AppServer/informe1.java:29: cannot resolve symbol
    symbol : class JRFillParameter
    location: class informe1
    private JRFillParameter parameter_REPORT_RESOURCE_BUNDLE = null;
    ^
    /opt/WebSphere/AppServer/informe1.java:30: cannot resolve symbol
    symbol : class JRFillParameter
    location: class informe1
    private JRFillParameter parameter_REPORT_CONNECTION = null;
    ^
    /opt/WebSphere/AppServer/informe1.java:31: cannot resolve symbol
    symbol : class JRFillParameter
    location: class informe1
    private JRFillParameter parameter_REPORT_PARAMETERS_MAP = null;
    ^
    /opt/WebSphere/AppServer/informe1.java:32: cannot resolve symbol

    ……

    ……

    net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
    See error messages above.
    [26/07/05 15:55:43:877 CEST] 5ed8cb9f SystemErr R at net.sf.jasperreports.engine.design.JRAbstractClassCompiler.compileReport(JRAbstractClassCompiler.java:121)
    [26/07/05 15:55:43:877 CEST] 5ed8cb9f SystemErr R at net.sf.jasperreports.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:106)
    [26/07/05 15:55:43:877 CEST] 5ed8cb9f SystemErr R at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:212)
    [26/07/05 15:55:43:877 CEST] 5ed8cb9f SystemErr R at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:198)
    [26/07/05 15:55:43:877 CEST] 5ed8cb9f SystemErr R at com.cetecom.sbsf.otrosInformes.GeneraInforme.generar(GeneraInforme.java:60)
    [26/07/05 15:55:43:877 CEST] 5ed8cb9f SystemErr R at com.cetecom.sbsf.otrosInformes.servlet.OtrosInformesServlet.doPost(OtrosInformesServlet.java:55)
    [26/07/05 15:55:43:877 CEST] 5ed8cb9f SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
    [26/07/05 15:55:43:877 CEST] 5ed8cb9f SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
    [26/07/05 15:55:43:878 CEST] 5ed8cb9f SystemErr R at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java(Compiled Code))
    [26/07/05 15:55:43:878 CEST] 5ed8cb9f SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java(Compiled Code))
    [26/07/05 15:55:43:878 CEST] 5ed8cb9f SystemErr R at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java(Compiled Code))
    [26/07/05 15:55:43:878 CEST] 5ed8cb9f SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java(Inlined Compiled Code))
    [26/07/05 15:55:43:878 CEST] 5ed8cb9f SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java(Compiled Code))
    [26/07/05 15:55:43:878 CEST] 5ed8cb9f SystemErr R at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java(Compiled Code))
    [26/07/05 15:55:43:878 CEST] 5ed8cb9f SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java(Inlined Compiled Code))
    [26/07/05 15:55:43:878 CEST] 5ed8cb9f SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java(Compiled Code))
    [26/07/05 15:55:43:878 CEST] 5ed8cb9f SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java(Compiled Code))
    [26/07/05 15:55:43:878 CEST] 5ed8cb9f SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java(Compiled Code))
    [26/07/05 15:55:43:878 CEST] 5ed8cb9f SystemErr R at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
    [26/07/05 15:55:43:878 CEST] 5ed8cb9f SystemErr R at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274)

    Please help ¡¡¡

  42. To solve the problem describe in the comment n°15 (written by Beginner), you just have to set the property “jasper.reports.compile.class.path” with the path where the jasperreports lib is located (\WEB-INF\lib\jasperreports-0.6.8.jar for me).

    e.g. :

    System.setProperty(“jasper.reports.compile.class.path”, “\WEB-INF\lib\jasperreports-0.6.8.jar”);
    JasperReport jasperReport = JasperCompileManager.compileReport(Configuration.getConfig(Configuration.TEMPLATE_JRXML));

  43. hi!
    i have a problem in adding space before the string in reports. i have 3 rows out of which first is the parent row and the other two are child rows. now i need to print the
    child rows leaving some space from the starting. so that it looks like tree structure. so how can i do this.

    thanks
    anil.

  44. I have my reports up and running, just one problem:
    When I close my report my client running exits. Any idea why it does this or what I’ve missed along the way?
    After I have my “jasperPrint”, I view my report using the following:

    JasperViewer.viewReport(jasperPrint);

  45. this is fine I learnt from this how to generate reports. I was checking for how to convert the jasperprint object to XLS. I could not find any where an example to convert to XLS in a simple manner with the .jrxml file.could u pls mail to me immediately if u know

  46. I am having what appears to be a common problem with the jasper-jars on the java.class.path env variable. This only manifests from the appserver, my corresponding unit test works perfectly. This is consistant because Websphere (avoid it possible!) and I am assuming JBoss and other appservers as well, load stuff from $WEBAPP/WEB-INF/lib in their own class loaders, and consequently the jars don’t appear on the java.class.path system property. So when Jasper tries to compile it’s stuff using tools.jar, the class loader containing the Javac can’t see anything loaded by the web appclassloader. (This is my guess, by the way, not fact). When I added jasper to the $JRE/lib/ext, I got lots of other weird errors in other parts of the system, so this doesn’t seem to be an option. I would have problems with the network admins, even if it did work, because they might not OK the change to the core JRE (securinoia).

    Point being: If there is an alternative way to get a compiled JasperReport object fromt an .jrxml report spec, I would love to know about it. It would save me alot of headaches.

    Here are the errors I was getting from the compiler:

    [5/27/05 14:23:30:688 EDT] 6bca607a SystemErr R C:\WebSphere\CustomersReport.java:4: package net.sf.jasperreports.engine does not exist
    [5/27/05 14:23:30:688 EDT] 6bca607a SystemErr R import net.sf.jasperreports.engine.*;
    [5/27/05 14:23:30:688 EDT] 6bca607a SystemErr R ^
    [5/27/05 14:23:30:698 EDT] 6bca607a SystemErr R C:\WebSphere\CustomersReport.java:5: package net.sf.jasperreports.engine.fill does not exist
    [5/27/05 14:23:30:698 EDT] 6bca607a SystemErr R import net.sf.jasperreports.engine.fill.*;
    [5/27/05 14:23:30:698 EDT] 6bca607a SystemErr R ^
    [5/27/05 14:23:30:808 EDT] 6bca607a SystemErr R C:\WebSphere\CustomersReport.java:18: cannot resolve symbol
    symbol : class JRCalculator
    location: class CustomersReport

  47. can we get the parameters with out using java code in ireport means taking a textbox while giving a value we have to get the output in the report

  48. I’m a beginner. The code work very well. the sample is good to learn jasperreports
    Tankyou to all(don’t worry about my english, I’m a francophone)

  49. Hello, I had the same problem (SAXParseException).
    It was the following jar to my classpath that cause the problem : gnujaxp.jar
    You must remove it from your classpath.

  50. Hello all,
    first of all thank you for your kind help us using JasperReport,
    i used your code typically as you mentioned and i included the commons jars ,
    and i use jasper report version 0.6.6 , but i still getting the error following:

    0 [AWT-EventQueue-0] ERROR digester.Digester - Parse Warning at line 1 column 0: URI was not reported to parser for entity [document]

    org.xml.sax.SAXParseException: URI was not reported to parser for entity [document]

    at gnu.xml.aelfred2.SAXDriver.warn(SAXDriver.java:934)

    at gnu.xml.aelfred2.SAXDriver.startExternalEntity(SAXDriver.java:631)

    at gnu.xml.aelfred2.XmlParser.pushURL(XmlParser.java:3358)

    at gnu.xml.aelfred2.XmlParser.doParse(XmlParser.java:159)

    at gnu.xml.aelfred2.SAXDriver.parse(SAXDriver.java:320)

    at gnu.xml.aelfred2.XmlReader.parse(XmlReader.java:294)

    at org.apache.commons.digester.Digester.parse(Digester.java:1515)

    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:356)

    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:341)

    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:295)

    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:279)

    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:143)

    at DCS.view.TryPrint.jButton1_actionPerformed(TryPrint.java:180)

    at DCS.view.TryPrint.access$6000071(TryPrint.java:38)

    at DCS.view.TryPrint$1.actionPerformed(TryPrint.java:157)

    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)

    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)

    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)

    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)

    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)

    at java.awt.Component.processMouseEvent(Component.java:5100)

    at java.awt.Component.processEvent(Component.java:4897)

    at java.awt.Container.processEvent(Container.java:1569)

    at java.awt.Component.dispatchEventImpl(Component.java:3615)

    at java.awt.Container.dispatchEventImpl(Container.java:1627)

    at java.awt.Component.dispatchEvent(Component.java:3477)

    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)

    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)

    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)

    at java.awt.Container.dispatchEventImpl(Container.java:1613)

    at java.awt.Window.dispatchEventImpl(Window.java:1606)

    at java.awt.Component.dispatchEvent(Component.java:3477)

    at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)

    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)

    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)

    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)

    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)

    at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

    can you please help me solving this exception?
    thanks in advance

  51. I have the same problem as Beginner. I am using net.sf.jasperreports.ant.JRAntCompileTask to compile the jasper design files(.xml) from the project build.xml file. Can anyone suggest me what to do ???

  52. Salute everyone,
    I am a newbee to java and jasperreports, so I have a little problem(probably I just don’t know smth): My JRE is situated on LINUX RED HAT 7.0 server. Java application is compiled to class without errors and warnings. When I run it using X-window it works, but when i try to do the same from trminal shell (without x-window – i connect thru ssh), I get this error: Exception in thread “main” java.lang.InternalError: Can’t connect to X11 window server using ‘:0.0′ as the value of the DISPLAY variable.
    at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
    at sun.awt.X11GraphicsEnvironment.(X11GraphicsEnvironment.java:134)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:141)
    at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
    at dori.jasper.engine.util.JRGraphEnvInitializer.initializeGraphEnv(JRGraphEnvInitializer.java:101)
    at dori.jasper.engine.fill.JRBaseFiller.(JRBaseFiller.java:208)
    at dori.jasper.engine.fill.JRVerticalFiller.
    (JRVerticalFiller.java:123)
    at dori.jasper.engine.fill.JRVerticalFiller.
    (JRVerticalFiller.java:115)
    at dori.jasper.engine.fill.JRFiller.fillReport(JRFiller.java:110)
    at dori.jasper.engine.JasperFillManager.fillReport(JasperFillManager.java:219)
    at JasperStart.main(JasperStart.java:57)

    Can anyone tell me what is wrong?

    And another request – where can be found The JasperReports Ultimate Guide document?

    Any help would be appreciated. Thanks a lot and good luck!

  53. Hello:
    I want to create frozen columns in my report. Does anybody know how to do this ??? or does anybody
    knows how to “export” the data from my jasper Report to an object so I can print it in a swing
    grill ??????

  54. Hi,
    I am using Japser reports to generate PDF reports. How do I have an image on my PDF generated? Any help would be appreciated.
    thanks !
    Lavanya

  55. Hello as a beginner I am getting errors while using jasper report
    I got following errror

    Exception in thread “main” javax.xml.parsers.FactoryConfigurationError: java.lang.ClassNotFoundException: org.apache.crimson.jaxp.SAXParserFactoryImpl
    at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:120)
    at org.apache.commons.digester.Digester.getFactory(Digester.java:511)
    at org.apache.commons.digester.Digester.setFeature(Digester.java:569)
    at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.configureDigester(JRXmlDigesterFactory.java:88)
    at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createDigester(JRXmlDigesterFactory.java:296)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:330)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:295)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:279)
    Can u help me out??
    How to write a .xml file to generate report having some static text?

  56. Hello as a beginner I am getting errors while using jasper report
    I got following errror

    Exception in thread “main” javax.xml.parsers.FactoryConfigurationError: java.lang.ClassNotFoundException: org.apache.crimson.jaxp.SAXParserFactoryImpl
    at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:120)
    at org.apache.commons.digester.Digester.getFactory(Digester.java:511)
    at org.apache.commons.digester.Digester.setFeature(Digester.java:569)
    at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.configureDigester(JRXmlDigesterFactory.java:88)
    at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createDigester(JRXmlDigesterFactory.java:296)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:330)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:295)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:279)
    Can u help me out??
    How to write a .xml file to generate report having some static text?

  57. Hello as a beginner I am getting errors while using jasper report
    I got following errror

    Exception in thread “main” javax.xml.parsers.FactoryConfigurationError: java.lang.ClassNotFoundException: org.apache.crimson.jaxp.SAXParserFactoryImpl
    at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:120)
    at org.apache.commons.digester.Digester.getFactory(Digester.java:511)
    at org.apache.commons.digester.Digester.setFeature(Digester.java:569)
    at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.configureDigester(JRXmlDigesterFactory.java:88)
    at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createDigester(JRXmlDigesterFactory.java:296)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:330)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:295)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:279)
    Can u help me out??
    How to write a .xml file to generate report having some static text?

  58. I have a problem as a beginner
    I got error as

    Exception in thread “main” javax.xml.parsers.FactoryConfigurationError: java.lang.ClassNotFoundException: org.apache.crimson.jaxp.SAXParserFactoryImpl
    at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:120)
    at org.apache.commons.digester.Digester.getFactory(Digester.java:511)
    at org.apache.commons.digester.Digester.setFeature(Digester.java:569)
    at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.configureDigester(JRXmlDigesterFactory.java:88)
    at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createDigester(JRXmlDigesterFactory.java:296)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:330)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:295)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:279)

    Can u solve it?
    Can u guide me for how to right xml for a simple report displaying only some text

  59. I have the same problem as beginner. I get the same errors when calling compileReport(String filename).
    When i put the jar into the classpath (and see it using system.getProperty(“java.class.path”) it is there.
    But, it wont even parse the report file because it now says it cannot find digester. When I put digester in there, JBoss wont even start up.
    I am using JBoss 5, Eclipse 3, and JR 0.6.6. Any help would be great! Thanks much.

  60. dear ‘beginner’ (post @ 8/4/2005 2:14 pm),
    thanx for posting that big list of 100 all-so-different compilation-errors ;)
    At first glance, it looks like you don’t have the JRFillField in your classpath.
    Since this is only a compilation-error, please use an IDE like for example Eclipse. It will tell you immediately what’s wrong.

  61. John Tharakan on

    why do i get the class NoClassDefFoundError pointing to the line which contains the JasperDesign jasperDesign = JRXmlLoader.load(“EmpDeptReport.xml�);

  62. I have set the class path but it gives me the following error
    C:\WINNT\system32\StudentRegister_Rpt.java:4: package net.sf.jasperreports.engine does not exist
    import net.sf.jasperreports.engine.*;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:5: package net.sf.jasperreports.engine.fill does not exist
    import net.sf.jasperreports.engine.fill.*;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:17: cannot resolve symbol
    symbol : class JRCalculator
    location: class StudentRegister_Rpt
    public class StudentRegister_Rpt extends JRCalculator
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:24: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    private JRFillParameter parameter_PG4 = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:25: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    private JRFillParameter parameter_PG3 = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:26: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    private JRFillParameter parameter_PG1 = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:27: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    private JRFillParameter parameter_PCountry_Code = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:28: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    private JRFillParameter parameter_GroupBy_Desc = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:29: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    private JRFillParameter parameter_REPORT_CONNECTION = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:30: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    private JRFillParameter parameter_REPORT_PARAMETERS_MAP = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:31: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    private JRFillParameter parameter_PMon = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:32: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    private JRFillParameter parameter_PExam_Centre_C = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:33: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    private JRFillParameter parameter_PYear = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:34: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    private JRFillParameter parameter_PCity = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:35: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    private JRFillParameter parameter_PG2 = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:36: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    private JRFillParameter parameter_PCourse_C = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:37: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    private JRFillParameter parameter_REPORT_DATA_SOURCE = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:38: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    private JRFillParameter parameter_PState_Code = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:39: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    private JRFillParameter parameter_REPORT_SCRIPTLET = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:41: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_course_start_date = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:42: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_pincode = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:43: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_country_name = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:44: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_language_name = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:45: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_student_id = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:46: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_address_line_1 = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:47: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_state_name = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:48: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_P4 = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:49: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_registration_number = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:50: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_middle_initials = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:51: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_address_line_2 = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:52: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_last_name = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:53: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_fax = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:54: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_course_name = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:55: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_P1 = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:56: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_office_phone = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:57: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_home_phone = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:58: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_exam_centre_name = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:59: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_P2 = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:60: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_P3 = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:61: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_mobile_phone = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:62: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_email_address = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:63: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_first_name = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:64: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    private JRFillField field_city = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:66: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_PAGE_NUMBER = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:67: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_COLUMN_NUMBER = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:68: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_REPORT_COUNT = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:69: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_PAGE_COUNT = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:70: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_COLUMN_COUNT = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:71: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_Group_1_COUNT = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:72: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_Group2_COUNT = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:73: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_Group_3_COUNT = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:74: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_Group_4_COUNT = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:75: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_Group_5_COUNT = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:76: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_Group_6_COUNT = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:77: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_Group_7_COUNT = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:78: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_G8_COUNT = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:79: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_lineheader_COUNT = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:80: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_Group_Header_COUNT = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:81: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_P1_COUNT = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:82: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_P2_COUNT = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:83: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_P3_COUNT = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:84: cannot resolve symbol
    symbol : class JRFillVariable
    location: class StudentRegister_Rpt
    private JRFillVariable variable_P4_COUNT = null;
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:94: cannot resolve symbol
    symbol : class JRException
    location: class StudentRegister_Rpt
    ) throws JRException
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:96: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    parameter_PG4 = (JRFillParameter)parsm.get(“PG4″);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:96: cannot resolve symbol
    symbol : variable parsm
    location: class StudentRegister_Rpt
    parameter_PG4 = (JRFillParameter)parsm.get(“PG4″);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:97: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    parameter_PG3 = (JRFillParameter)parsm.get(“PG3″);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:97: cannot resolve symbol
    symbol : variable parsm
    location: class StudentRegister_Rpt
    parameter_PG3 = (JRFillParameter)parsm.get(“PG3″);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:98: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    parameter_PG1 = (JRFillParameter)parsm.get(“PG1″);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:98: cannot resolve symbol
    symbol : variable parsm
    location: class StudentRegister_Rpt
    parameter_PG1 = (JRFillParameter)parsm.get(“PG1″);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:99: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    parameter_PCountry_Code = (JRFillParameter)parsm.get(“PCountry_Code”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:99: cannot resolve symbol
    symbol : variable parsm
    location: class StudentRegister_Rpt
    parameter_PCountry_Code = (JRFillParameter)parsm.get(“PCountry_Code”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:100: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    parameter_GroupBy_Desc = (JRFillParameter)parsm.get(“GroupBy_Desc”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:100: cannot resolve symbol
    symbol : variable parsm
    location: class StudentRegister_Rpt
    parameter_GroupBy_Desc = (JRFillParameter)parsm.get(“GroupBy_Desc”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:101: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    parameter_REPORT_CONNECTION = (JRFillParameter)parsm.get(“REPORT_CONNECTION”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:101: cannot resolve symbol
    symbol : variable parsm
    location: class StudentRegister_Rpt
    parameter_REPORT_CONNECTION = (JRFillParameter)parsm.get(“REPORT_CONNECTION”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:102: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    parameter_REPORT_PARAMETERS_MAP = (JRFillParameter)parsm.get(“REPORT_PARAMETERS_MAP”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:102: cannot resolve symbol
    symbol : variable parsm
    location: class StudentRegister_Rpt
    parameter_REPORT_PARAMETERS_MAP = (JRFillParameter)parsm.get(“REPORT_PARAMETERS_MAP”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:103: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    parameter_PMon = (JRFillParameter)parsm.get(“PMon”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:103: cannot resolve symbol
    symbol : variable parsm
    location: class StudentRegister_Rpt
    parameter_PMon = (JRFillParameter)parsm.get(“PMon”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:104: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    parameter_PExam_Centre_C = (JRFillParameter)parsm.get(“PExam_Centre_C”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:104: cannot resolve symbol
    symbol : variable parsm
    location: class StudentRegister_Rpt
    parameter_PExam_Centre_C = (JRFillParameter)parsm.get(“PExam_Centre_C”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:105: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    parameter_PYear = (JRFillParameter)parsm.get(“PYear”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:105: cannot resolve symbol
    symbol : variable parsm
    location: class StudentRegister_Rpt
    parameter_PYear = (JRFillParameter)parsm.get(“PYear”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:106: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    parameter_PCity = (JRFillParameter)parsm.get(“PCity”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:106: cannot resolve symbol
    symbol : variable parsm
    location: class StudentRegister_Rpt
    parameter_PCity = (JRFillParameter)parsm.get(“PCity”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:107: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    parameter_PG2 = (JRFillParameter)parsm.get(“PG2″);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:107: cannot resolve symbol
    symbol : variable parsm
    location: class StudentRegister_Rpt
    parameter_PG2 = (JRFillParameter)parsm.get(“PG2″);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:108: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    parameter_PCourse_C = (JRFillParameter)parsm.get(“PCourse_C”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:108: cannot resolve symbol
    symbol : variable parsm
    location: class StudentRegister_Rpt
    parameter_PCourse_C = (JRFillParameter)parsm.get(“PCourse_C”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:109: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    parameter_REPORT_DATA_SOURCE = (JRFillParameter)parsm.get(“REPORT_DATA_SOURCE”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:109: cannot resolve symbol
    symbol : variable parsm
    location: class StudentRegister_Rpt
    parameter_REPORT_DATA_SOURCE = (JRFillParameter)parsm.get(“REPORT_DATA_SOURCE”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:110: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    parameter_PState_Code = (JRFillParameter)parsm.get(“PState_Code”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:110: cannot resolve symbol
    symbol : variable parsm
    location: class StudentRegister_Rpt
    parameter_PState_Code = (JRFillParameter)parsm.get(“PState_Code”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:111: cannot resolve symbol
    symbol : class JRFillParameter
    location: class StudentRegister_Rpt
    parameter_REPORT_SCRIPTLET = (JRFillParameter)parsm.get(“REPORT_SCRIPTLET”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:111: cannot resolve symbol
    symbol : variable parsm
    location: class StudentRegister_Rpt
    parameter_REPORT_SCRIPTLET = (JRFillParameter)parsm.get(“REPORT_SCRIPTLET”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:113: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    field_course_start_date = (JRFillField)fldsm.get(“course_start_date”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:113: cannot resolve symbol
    symbol : variable fldsm
    location: class StudentRegister_Rpt
    field_course_start_date = (JRFillField)fldsm.get(“course_start_date”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:114: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    field_pincode = (JRFillField)fldsm.get(“pincode”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:114: cannot resolve symbol
    symbol : variable fldsm
    location: class StudentRegister_Rpt
    field_pincode = (JRFillField)fldsm.get(“pincode”);
    ^
    C:\WINNT\system32\StudentRegister_Rpt.java:115: cannot resolve symbol
    symbol : class JRFillField
    location: class StudentRegister_Rpt
    field_country_name = (JRFillField)fldsm.get(“country_name”);
    ^
    100 errors
    JRException:net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
    See error messages above.
    net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
    See error messages above.
    at net.sf.jasperreports.engine.design.JRAbstractJavaCompiler.compileReport(JRAbstractJavaCompiler.java:155)
    at net.sf.jasperreports.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:137)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:203)
    at ncmr.model.StudentRegisterBean.createReport(StudentRegisterBean.java:26)
    at ncmr.controller.StudentRegisterReportServlet.doProcess(StudentRegisterReportServlet.java:274)
    at ncmr.controller.StudentRegisterReportServlet.doPost(StudentRegisterReportServlet.java:311)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
    at java.lang.Thread.run(Thread.java:536)

  63. hello! is there any one that can help me in integrating/ viewing my xml file to the web. i have my GUI in jsp format, class file for the jasper, class file for the database connection and the xml file using jasperassistant, now, my problem is how to view my report in the web. furthermore, how to make complex query in jasperassistant, like multiple table in one query, because i’m integrating multiple query in one form or sheets of paper.

  64. hello! i like this site because it gives info. about jasperreport, but i’m glad if u can teach me how to used subreport, and querying in two or more tables with filtiring of reports. can u share some info about it?

  65. Gregory Beumer on

    Most of the problems in your comments are solved by adding the following jar’s to your classpath:

    /jasperreports-0.6.x-project/jasperreports-0.6.x/dist/jasperreports-0.6.x.jar
    /jasperreports-0.6.x-project/jasperreports-0.6.x/lib/itext-1.01.jar
    /jasperreports-0.6.x-project/jasperreports-0.6.x/lib/commons-beanutils-1.5.jar
    /jasperreports-0.6.x-project/jasperreports-0.6.x/lib/commons-collections-2.1.jar
    /jasperreports-0.6.x-project/jasperreports-0.6.x/lib/commons-digester-1.3.jar
    /jasperreports-0.6.x-project/jasperreports-0.6.x/lib/commons-logging-1.0.2.jar

    Lots of succes,

    Gregory Beumer

  66. why do i get the class NoClassDefFoundError pointing to the line which contains the JasperDesign jasperDesign = JRXmlLoader.load(“EmpDeptReport.xml”);

  67. Lucas Jellema on

    An interesting post by Andrej Koelewijn on his experiences with JasperReports and subsequent use of alternatives, among which most notably an HTML browser component within JClient applications: Swing embedded browser

  68. Hello experts,
    I am dyanmically creating a report using iReport, passing the values form the servlet to the designed page, but i want the code for calling that jasper jrxml or jasper file from the sevlet, and modification to the class path, what are the class path i should set, in order to generate the report dynamically form the servlet, and jar files.
    wating for u help

    Thanmaya Raghavaiah

  69. When I compiled ur code i got this error which i am not able to understand plz help me

    F:\j2sdk1.4.2_01\bin\java.exe -classpath “F:\j2sdk1.4.2_01\jre\lib\rt.jar;F:\j2sdk1.4.2_01\lib\tools.jar;C:\lib\gnujaxp.jar;C:\lib\jcommon-0.9.6.jar;C:\lib\jfreechart-0.9.21.jar;C:\lib\junit.jar;C:\lib\mysql-connector-java.jar;C:\lib\servlet.jar;D:\Trans-e\Transe3.0\contexts\WEB-INF\classes;D:\Documents and Settings\admin\Desktop\jfree\jfreereport-0.8.4_11\jfreereport-0.8.4_11-all.jar;D:\Documents and Settings\admin\Desktop\jfree\jfreereport-0.8.4_11\jfreereport-0.8.4_11-core.jar;D:\Documents and Settings\admin\Desktop\jfree\jfreereport-0.8.4_11\lib\bsh-1.2b6.jar;D:\Documents and Settings\admin\Desktop\jfree\jfreereport-0.8.4_11\lib\gnujaxp.jar;D:\Documents and Settings\admin\Desktop\jfree\jfreereport-0.8.4_11\lib\itext-1.02b.jar;D:\Documents and Settings\admin\Desktop\jfree\jfreereport-0.8.4_11\lib\jcommon-0.9.7.jar;D:\Documents and Settings\admin\Desktop\jfree\jfreereport-0.8.4_11\lib\pixie-0.8.1.jar;D:\Documents and Settings\admin\Desktop\jfree\jfreereport-0.8.4_11\lib\poi-2.5.1-final-20040804.jar;F:\ant;C:\REPORT~1\jasper\classes;D:\DOCUME~1\admin\Desktop\JASPER~1.3\lib\ant-1.5.1.jar;D:\DOCUME~1\admin\Desktop\JASPER~1.3\lib\bsh-1.3.0.jar;D:\DOCUME~1\admin\Desktop\JASPER~1.3\lib\commons-beanutils-1.5.jar;D:\DOCUME~1\admin\Desktop\JASPER~1.3\lib\commons-collections-2.1.jar;D:\DOCUME~1\admin\Desktop\JASPER~1.3\lib\commons-digester-1.3.jar;D:\DOCUME~1\admin\Desktop\JASPER~1.3\lib\commons-logging-1.0.2.jar;D:\DOCUME~1\admin\Desktop\JASPER~1.3\lib\commons-logging-api-1.0.2.jar;D:\DOCUME~1\admin\Desktop\JASPER~1.3\lib\hsqldb-1.61.jar;D:\DOCUME~1\admin\Desktop\JASPER~1.3\lib\itext-1.01.jar;D:\DOCUME~1\admin\Desktop\JASPER~1.3\lib\poi-2.0-final-20040126.jar;D:\DOCUME~1\admin\Desktop\JASPER~1.3\lib\servlet.jar;D:\DOCUME~1\admin\Desktop\JASPER~1.3\lib\xalan.jar;D:\DOCUME~1\admin\Desktop\JASPER~1.3\lib\xercesImpl.jar;D:\DOCUME~1\admin\Desktop\JASPER~1.3\lib\xmlParserAPIs.jar;D:\DOCUME~1\admin\Desktop\JASPER~1.3\dist\jasperreports-0.6.3.jar” firstfile
    Mar 3, 2005 6:27:06 PM org.apache.commons.digester.Digester warning
    SEVERE: Parse Warning at line 1 column 0: URI was not reported to parser for entity [document]
    org.xml.sax.SAXParseException: URI was not reported to parser for entity [document]
    at gnu.xml.aelfred2.SAXDriver.warn(SAXDriver.java:934)
    at gnu.xml.aelfred2.SAXDriver.startExternalEntity(SAXDriver.java:631)
    at gnu.xml.aelfred2.XmlParser.pushURL(XmlParser.java:3358)
    at gnu.xml.aelfred2.XmlParser.doParse(XmlParser.java:159)
    at gnu.xml.aelfred2.SAXDriver.parse(SAXDriver.java:320)
    at gnu.xml.aelfred2.XmlReader.parse(XmlReader.java:294)
    at org.apache.commons.digester.Digester.parse(Digester.java:1514)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:400)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:384)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:338)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:322)
    at firstfile.main(firstfile.java:27)
    Finished executing

  70. Its giving me exception at Connection conn = Database.getConnection(); error msg : cannot resolve symbol, symbol : variable Database.

    Thanks
    Dell

  71. yeah, i would like that too! i’d also like worldpeace, and someone to do my homework for me.. ;p

  72. i like to have examples in jasper reports generated dynamically by user by giving values at command line .and also printWhenExpression attribute examples

  73. Nice comment on Matt Raible’s weblog;see comment on http://www.raibledesigns.com/page/rd

    Using JasperReports with AppFuse and Spring Category: Java

    In Spring 1.1.3, support was added for using JasperReports with Spring MVC. Today, Gregory Beumer posted a nice overview of JasperReports. This inspired me to dig up Gilberto’s post on How to integrate JasperReports with AppFuse. If you’re looking for a reporting solution in your AppFuse-based application, and you’re using Spring MVC … enjoy! I plan on adding this to the wiki in the future, along with howtos for integrating JasperReports with Struts, WebWork, JSF and Tapestry. If you happen to know of tutorials for integrating JasperReports with these other frameworks, please let me know. January 20, 2005 08:12 AM MST Permalink

  74. Pingback: » AMIS WebLog crosses the 500,000 marker - half a million post-reads in just over a year

  75. Pingback: cat /dev/random » Links