77

I am trying to compile my JasperReports template using an Ant script and Java. I am getting this error:

jasper java.lang.NoClassDefFoundError:
org/codehaus/groovy/control/CompilationFailedException

There is nothing complex in the template, but I still can't compile.

Natty
  • 51
  • 1
  • 3
  • 8

6 Answers6

175

You will have to set the language value in your template to Java. There are two ways you can do this:

  1. If you are using iReport, select the root object in your Report Inspector (the one with the same name as your report). Then in the Properties window, select Java from the Languages drop-down.

  2. If you are editing the raw mark-up in the JRXML file, remove language="groovy" from the file altogether.

Then try to recompile - you should be sorted. :)

David
  • 15,652
  • 26
  • 115
  • 156
travega
  • 8,284
  • 16
  • 63
  • 91
10

If you are using Maven, you must add the groovy dependency in your pom.xml.

<dependency>
    <groupId>org.codehaus.groovy</groupId>
    <artifactId>groovy-all</artifactId>
    <version>2.4.10</version>
</dependency>

In another case, you must add the library groovy in your lib folder (WEB-INF/lib)

martosfre
  • 764
  • 6
  • 14
8

Another solution is to copy groovy-all-{version}.jar from the groovy binary distribution into the application's.

  • 6
    Bad solution, as you're merely satisfying a new and unnecessary dependency requirement. In travega's answer you're removing the dependency requirement completely, which is the better way to go. – ADTC Jun 03 '14 at 08:31
  • 2
    This depends on whether you are using groovy expression or not in your report...., switching to java will make your groovy expression as == fail. (note the solution is to copy the libraries from the jasper report distribution (lib) relative to groovy in the classpath) – Petter Friberg Jan 08 '16 at 00:12
5

If you are using TIBCOJaspersoftStudio:

  1. Download latest groovy 2.4.* jar from https://groovy.apache.org/download.html
  2. Unpack and get this file ./groovy-2.4.10/embeddable/groovy-all-2.4.10.jar
  3. Put the jar in ./TIBCOJaspersoftStudio-6.3.1.final/plugins
  4. Delete the old jar: ./TIBCOJaspersoftStudio-6.3.1.final/plugins/groovy-all_2.4.5.jar
Dave Jarvis
  • 30,436
  • 41
  • 178
  • 315
Topera
  • 12,223
  • 15
  • 67
  • 104
3

Change the languge to java in JRXML (ex:- language="java") or add groovy*.jar to your project’s classpath.

achini
  • 419
  • 4
  • 7
0

Your are missing the a important library groovy in path.

case 1 : if you are using Maven add this dependency with compatible version in pom.xml

<dependency>
    <groupId>org.codehaus.groovy</groupId>
    <artifactId>groovy-all</artifactId>
    <version>3.0.4</version>
</dependency>

Case 2 : Second way is add the compatible version of groovy jar in class path

Url to download groovy jar : http://groovy-lang.org/download.html

Jimmy
  • 995
  • 9
  • 18