Lloyd Meinholz
Lloyd Meinholz

Reputation: 2600

Error compiling JasperReport 4.1.3 created from iReport 4.1.3 with Groovy 1.8.1

I'm on Windows 7 64-bit, using JDK 1.6.0_29, groovy 1.8.1, and JasperReports/iReport 4.1.3.

I have the following jars from the JasperReports distribution in my CLASSPATH:

commons-beanutils-1.8.0.jar, commons-collections-2.1.1.jar, commons-digester-1.7.jar, commons-logging-1.0.4.jar, jasperreports-4.1.3.jar, poi-3.7-20101029.jar

I have also tried adding all the jars in the ${JASPER_HOME}/lib distribution in case I was missing some important jar.

The jasper report is to be generated by a groovy script. I have created a very simple report with iReport that contains only some static text in the title. I am able to compile and view the report from within iReport.

When I try and compile the report from the script:

def jasperReport = JasperCompileManager.compileReport("filename")

I get the following error:

Caught: java.lang.AbstractMethodError
java.lang.AbstractMethodError
    at net.sf.jasperreports.compilers.JRGroovyCompiler.compileUnits(JRGroovyCompiler.java:96)
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:188)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:212)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:145)
    at net.sf.jasperreports.engine.JasperCompileManager$compileReport.call(Unknown Source)
    at wis_validate_environment.run(wis_validate_environment.groovy:58)

Is there possibly some conflict between the groovy that JasperReports is using (JRGroovyCompiler? from the stacktrace) and the groovy that I am using to compile the report?

Upvotes: 0

Views: 3441

Answers (2)

David Stubbs
David Stubbs

Reputation: 11

I found the problem was explained here:

http://www.mail-archive.com/[email protected]/msg23404.html

There seems to be a problem with the versions of one of the dependent libraries that our project uses that conflicts with groovy's.

In short use groovy-all.jar or make sure are your dependancies match those of the version of groovy you are using.

Upvotes: 1

Lloyd Meinholz
Lloyd Meinholz

Reputation: 2600

There were a couple of things I had to change in order to resolve this issue.

Creating a report using the Report Wizard and the default settings creates the language="groovy" parameter in the jasperReport tag. When I remove language parameter, I no longer get the AbstractMethodError mentioned above.

I also needed to add the jdt-compiler-3.1.1.jar in my classpath.

Upvotes: 1

Related Questions