Some common errors in Jasper report: SEVERE: Digester.getParser and JRException: Error compiling report java source files

I’ve followed a tutorial on how to use Jasper report in Netbeans IDE at http://developers.sun.com/jsenterprise/reference/techart/jse8/jasper_reports.html

However, I encountered the following problems.

(Please note that when I refer to jasperreport library, I mean my customized library that contains a number of jar files that are necessary to compile and run jasperreport. You can name the library whatever you’d like to.

ERROR#1:

<code>

Feb 15, 2008 4:23:50 PM org.apache.commons.digester.Digester getParser
SEVERE: Digester.getParser:
javax.xml.parsers.ParserConfigurationException: XML document validation is not supported
at com.bluecast.xml.JAXPSAXParserFactory.newSAXParser(JAXPSAXParserFactory.java:103)

</code>

I am not sure if I understand it correctly. After several goolging attempts, I’ve found that it’s because there are more than one xml parser libraries in the library path of the project running Jasper. As a result, Jasper report uses the wrong xerces.jar path.

From my understanding is that:

  • A project contains several tasks relating to XML documents such as parsing text from XML documents and creating Jasper report.
  • Developer of the project add other xml parser libraries in addition to the Jasper report library into the project library class path. For example, the developer adds piccolo.jar and jasperreports–version–.jar and other commons jar libraries.
  • The problem is that instead of using its own xerces library, the Jasper report uses xerces of the piccolo.jar library. (It may not be correct, but the idea is Jasper uses the wrong library).
  • As a results, when executing the program, the error above is generated.

SOLUTION for ERROR #1

The solution to this error is that we need to put jasperreports library in front of piccolo library in the project library class path. To do this in Netbeans IDE 6.0.1, perform the following steps.

  1. Right click on the project name in the project window
  2. Click on Properties
  3. Click on Libraries
  4. We will see that the jasper library is below piccolo library.
  5. To fix the error, click on Jasper library and click “Move up” to move the Jasper library to be above other xml parser libraries such as “Piccolo” or “Jdom”.
  6. Close the project library window, click Run again on the Netbeans IDE.

ERROR#2

After I fixed the ERROR#1 above, I get this error#2. The cause of this error is that it requires jdt-compiler–version–.jar library. This library can be found in the “lib” directory under the jasperreports-project.tar.gz.

<code>

net.sf.jasperreports.engine.JRException: Error compiling report java source files : /HelloReportWorld_1203118710653_430914.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.JasperCompileManager.compileReport(JasperCompileManager.java:220)

</code>

SOLUTION for ERROR#2

===================

To fix this error, we will add jdt-compiler-version.jar into the jasper library in the Netbeans IDE. Follow the steps below.

  1. On the Netbeans IDE, Tools–>Libraries
  2. Click on “Jasper” on the Libraries window. (Note that “Jasper” is the name of Jasper library that contains jasperreports.jar and other commons-.jar libraries. The name of this library can be arbitrary, depending on developer.)
  3. Then, click “Add Jar”
  4. Browse the where the jdt-compiler-version.jar is, and add it to the “Jasper” library.
  5. Close the library window, and run the program again.

Now, the Jasper report should be generated successfully.

ERROR #3: I receive another error when I try to generate pdf document using:

<code>

JasperExportManager.exportReportToPdfFile(
jasperPrint, reportDest);

</code>

SOLUTION TO ERROR #3: If anyone gets an error when running jasperreports for generating pdf file, to fix this error you have to add itext.jar library to the Jasper library.

Just for a reference, libraries that I’ve added to the Jasper library are:

  • commons-beanutils-1.7.jar
  • commons-collections-2.1.jar
  • commons-digester.jar
  • commons-javaflow-20060411.jar
  • commons-logging-2.0.1.jar
  • jdt-compiler-3.1.1.jar
  • jasperreports-2.04.jar
  • xercesImpl.jar (This library is required for fixing ERROR#1)
  • itext-1.3.1.jar (for printing pdf)
Advertisements
This entry was posted in Java. Bookmark the permalink.

9 Responses to Some common errors in Jasper report: SEVERE: Digester.getParser and JRException: Error compiling report java source files

  1. BHUSHAN CHAUDHARI says:

    Thanks for suggetion.

  2. tony yan says:

    great job,dear friend. i also confused by the tutorial, it created long long ago…..

  3. vinoth kumar says:

    javax.xml.ws.WebServiceException: Unable to create JAXBContext due to the security restriction

    i’m getting this error when i’m compile my servlet program which is going to connect into jasper report.

    can u plz give me the suggestions to overcome this error

  4. qwanto says:

    Thanks!

    Followed the exact same tutorial, and ran into ERROR#2.

  5. farisi says:

    great article, thanks

  6. sanjay says:

    Thanks buddy ! You made my day …

  7. Shirish says:

    Hey thanks for your valuable comments

  8. Steve says:

    Thanks man you put a smile on my face ūüėÄ

  9. SUPREETH says:

    Error¬†filling¬†print…¬†Error¬†evaluating¬†expression¬†:¬† ¬†¬†¬†¬†Source¬†text¬†:¬†$F{END_TIME}
    net.sf.jasperreports.engine.fill.JRExpressionEvalException:¬†Error¬†evaluating¬†expression¬†:¬† ¬†¬†¬†¬†Source¬†text¬†:¬†$F{END_TIME}¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:195)¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:589)¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:557)¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:929)¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:383)¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:368)¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258)¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:499)¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2036)¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:760)¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:290)¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:132)¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:946)¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845)¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58)¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247)¬† ¬†¬†¬†¬†at¬†com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:878)¬† ¬†¬†¬†¬†at¬†org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)¬† ¬†¬†¬†¬†at¬†org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)¬† Caused¬†by:¬†org.codehaus.groovy.runtime.typehandling.GroovyCastException:¬†Cannot¬†cast¬†object¬†‘oracle.sql.TIMESTAMP@16cb856’¬†with¬†class¬†‘oracle.sql.TIMESTAMP’¬†to¬†class¬†‘oracle.sql.TIMESTAMP’¬† ¬†¬†¬†¬†at¬†org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:327)¬† ¬†¬†¬†¬†at¬†org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:602)¬† ¬†¬†¬†¬†at¬†Reconciliation_execution_status_Report_1318485205281_751615.evaluate(calculator_Reconciliation_execution_status_Report_1318485205281_751615:179)¬† ¬†¬†¬†¬†at¬†net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:182)¬† ¬†¬†¬†¬†…¬†19¬†more¬†

    CAN ANYONE HELP ME OUT TO GET RESOLVE ABOVE ERROR

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s