Issue: JasperReports compilation error on server but works fine on localhost
I have a problem when trying to generate a report using my application on a server. Everything works fine on my localhost, but on the server, the report generation fails, and the logs show the following error:
Errors were encountered when compiling report expressions class file:
/application/LetterTemplate_d187f8800d77ab9c55212eadd29ea4067a8981afea6b465597eb80aa2476b409.java:18: error: cannot find symbol
public class LetterTemplate_d187f8800d77ab9c55212eadd29ea4067a8981afea6b465597eb80aa2476b409 extends JREvaluator
^
symbol: class JREvaluator
/application/LetterTemplate_d187f8800d77ab9c55212eadd29ea4067a8981afea6b465597eb80aa2476b409.java:25: error: cannot find symbol
private JRFillField field_account_no = null;
^
symbol: class JRFillField
location: class LetterTemplate_d187f8800d77ab9c55212eadd29ea4067a8981afea6b465597eb80aa2476b409
...
There are several similar errors about missing symbols for classes like JREvaluator
and JRFillField
, and the compilation fails with 21 errors. The logs also mention:
Note: /application/LetterTemplate_d187f8800d77ab9c55212eadd29ea4067a8981afea6b465597eb80aa2476b409.java uses or overrides a deprecated API.
However, when I run the same application locally, the report generation works perfectly, and I don't encounter this issue.
Environment details:
Local environment: Everything works fine.
OS: window
Java version: "11.0.22" 2024-01-16 LTS
JasperReports version: 7.0.0
Server environment: Report generation fails.
OS: ubantu
Java version: 11.0.24
JasperReports version: 7.0.0
What I’ve tried:
Ensured that the correct versions of JasperReports are included in the server environment.
Checked the classpath to ensure the required JasperReports JARs (like jasperreports-x.x.x.jar
) are present on the server.
Recompiled with -Xlint:deprecation
to see more details about the deprecated API.
Questions:
Why would the server be missing symbols like JREvaluator
and JRFillField
when the same code works locally?
Could this be related to classpath differences between my local machine and the server? How can I verify that?
Are there any known issues with specific versions of JasperReports that could cause this, or is it a configuration issue on the server?
Any help or suggestions on what to check or how to fix this would be greatly appreciated. Thanks!
Add a jasperreports-jdt jar and its dependency ecj to your application's classpath.