Jasper Report UberJar Deployment Error

Good day,

I’ve managed to use Jasper report template in my application to display results as pdf. This works fine on my development machine, but get errors when I want to run the report on the production machine. I use a UberJar as deployment option and host it on a Ubuntu machine with Tomcat application server.

A snippet of the error:

com.haulmont.reports.exception.ReportingException: Error formatting jasper report: Errors were encountered when compiling report expressions class file:
/Quote_1528711039046_99954.java:4: error: package net.sf.jasperreports.engine does not exist
import net.sf.jasperreports.engine.*;
/Quote_1528711039046_99954.java:5: error: package net.sf.jasperreports.engine.fill does not exist
import net.sf.jasperreports.engine.fill.*;
/Quote_1528711039046_99954.java:18: error: cannot find symbol
public class Quote_1528711039046_99954 extends JREvaluator

It seems that I’m missing a dependency, but are not sure how to add it to the application server?

Any help would be appreciated.

We have reproduced the problem and created the issue.
Thank you.

We have investigated the problem and found out that the user should manually add the jars:

  1. Copy jasperreports-.jar and yarg-.jar to the directory from where the uberJar is launched.
  2. Create the “jasperreports,propeties” file in this folder
  3. Put the following string to the file (define versions of your libraries)
    net.sf.jasperreports.compiler.classpath = jasperreports-6.4.1.jar;yarg-2.0.14.jar

After this everything works OK.

We are going to add this guidance to the documentation. Thank you.


It has been some time when I have raised this issue but like to revisit it please.

Thank you for the suggestion and also fix that was noted but I’m still struggling to get the deployed Jasper Template executed. I’m using Docker and UberJar as deployment options and included the 3 files as per recommendation. I can also confirm that the files did transfer to the docker machine along with the app.jar

However, if i want to preview my report from the application, I still get the error.

Do I need to specify somewhere in Cuba to include the jasperreports.properties, or do you perhaps have a sample project that I can test please?

Kind regards


You do not need to specify anything in Cuba, it should work if you placed jars and created jasperreports.properties file with names of placed jars. Does the problem occurs only if you use Docker?

You can try sample project from this page.

Regards, Sergey.

The problem is different (Linux) environment, try use colon instead of semicolon.
My working solution is:
net.sf.jasperreports.compiler.classpath = ./jasperreports-6.9.0.jar:./yarg-2.2.6.jar

Since all necessary classes of jasperreports-6.9.0.jar, yarg-2.2.6.jar, jasperreports-fonts-6.8.0.jar already present in uberJar, there is more convenient way to fix jasper:

  1. Add 'org.eclipse.jdt.core.compiler:ecj:4.4.2' dependency to coreModule at build.gradle. At this moment, by default, when using uberJar, built as described in documentation, net.sf.jasperreports.engine.design.JRJavacCompiler used for compiling reports. After providing org.eclipse.jdt.core.compiler:ecj, jasper automaticly uses net.sf.jasperreports.engine.design.JRJdtCompiler, which is much faster.
  2. For using jasperreports-fonts extension, it’s possible to copy jasperreports_extension.properties from jasperreports-fonts-6.8.0.jar to root of src folder of core module.
  3. It works fine in docker with just one uber jar.
  4. The most valueable benefit of this configuration is the ability to call project’s classes directly from JRXML template, which is not possible in case of using net.sf.jasperreports.engine.design.JRJavacCompiler, since project classes packed in uber jar.