While running jar file it is not able to locate jasper related classes/packages but everything working fine locally on IDE.
I'm using
jasper 7.0.0
jdk 17
SpringBoot 3.2.5
I'm working with JasperReports 7.0.0, which was recently released in 2024. Possibility of duplicate question but I've noticed that many existing resources and answers online are more than 10 years old and may not be applicable to the latest version.
Exception:
net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:18: error: cannot find symbol
public class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a extends JREvaluator
^
symbol: class JREvaluator
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:25: error: cannot find symbol
private JRFillField field_first_name = null;
^
symbol: class JRFillField
location: class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:26: error: cannot find symbol
private JRFillField field_middle_name = null;
^
symbol: class JRFillField
location: class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:27: error: cannot find symbol
private JRFillField field_last_name = null;
^
symbol: class JRFillField
location: class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:28: error: cannot find symbol
private JRFillField field_lan = null;
^
symbol: class JRFillField
location: class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:29: error: cannot find symbol
private JRFillField field_loan_amount = null;
^
symbol: class JRFillField
location: class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:30: error: cannot find symbol
private JRFillField field_closure_date = null;
^
symbol: class JRFillField
location: class
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:4: error: package net.sf.jasperreports.engine does not exist
import net.sf.jasperreports.engine.;
^
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:5: error: package net.sf.jasperreports.engine.fill does not exist
import net.sf.jasperreports.engine.fill.;
^
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:67: error: cannot find symbol
field_first_name = (JRFillField)fm.get("first_name");
^
symbol: class JRFillField
location: class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:68: error: cannot find symbol
field_middle_name = (JRFillField)fm.get("middle_name");
^
symbol: class JRFillField
location: class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:69: error: cannot find symbol
field_last_name = (JRFillField)fm.get("last_name");
^
symbol: class JRFillField
location: class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:70: error: cannot find symbol
field_lan = (JRFillField)fm.get("lan");
^
symbol: class JRFillField
location: class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:71: error: cannot find symbol
field_loan_amount = (JRFillField)fm.get("loan_amount");
^
symbol: class JRFillField
location: class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:72: error: cannot find symbol
field_closure_date = (JRFillField)fm.get("closure_date");
^
symbol: class JRFillField
location: class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:73: error: cannot find symbol
field_address46city = (JRFillField)fm.get("address.city");
^
symbol: class JRFillField
location: class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:74: error: cannot find symbol
field_address46state = (JRFillField)fm.get("address.state");
^
symbol: class JRFillField
location: class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:75: error: cannot find symbol
field_address46pincode = (JRFillField)fm.get("address.pincode");
^
symbol: class JRFillField
location: class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:76: error: cannot find symbol
field_address_ln1 = (JRFillField)fm.get("address_ln1");
^
symbol: class JRFillField
location: class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:77: error: cannot find symbol
field_address_ln2 = (JRFillField)fm.get("address_ln2");
^
symbol: class JRFillField
location: class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a
/home/prasant/IdeaProjects/template-service/ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a.java:78: error: cannot find symbol
field_address_ln3 = (JRFillField)fm.get("address_ln3");
^
symbol: class JRFillField
location: class ndc_e4e94dbb4bb5c2598541de434f487387b2120d24cdbc299c729f5879de51f41a
27 errors
Add following dependency will solve the issue.
I've already invested 1 day to find this ,most of the solutions which is available will ask you to add jdt compiler or ecj dependency but it works perfectly for jasper 7.0.0.
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-jdt</artifactId>
<version>7.0.0</version>
</dependency>