Error combine jasper report with java servlet
I am generating reports using jasperReports in dwr.i am getting these errors
INFO: Errors were encountered when compiling report expressions class file: C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:4: package net.sf.jasperreports.engine does not exist import net.sf.jasperreports.engine.*; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:5: package net.sf.jasperreports.engine.fill does not exist import net.sf.jasperreports.engine.fill.*; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:13: package net.sf.jasperreports.engine does not exist import net.sf.jasperreports.engine.*; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:15: package net.sf.jasperreports.engine.data does not exist import net.sf.jasperreports.engine.data.*; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:21: cannot find symbol symbol: class JREvaluator public class classic_1314606689888_793831 extends JREvaluator ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:28: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 private JRFillParameter parameter_REPORT_LOCALE = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:29: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 private JRFillParameter parameter_JASPER_REPORT = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:30: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 private JRFillParameter parameter_REPORT_VIRTUALIZER 开发者_StackOverflow中文版= null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:31: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 private JRFillParameter parameter_REPORT_TIME_ZONE = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:32: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 private JRFillParameter parameter_SORT_FIELDS = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:33: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 private JRFillParameter parameter_REPORT_FILE_RESOLVER = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:34: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 private JRFillParameter parameter_REPORT_SCRIPTLET = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:35: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 private JRFillParameter parameter_REPORT_PARAMETERS_MAP = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:36: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 private JRFillParameter parameter_REPORT_CONNECTION = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:37: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 private JRFillParameter parameter_REPORT_CLASS_LOADER = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:38: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 private JRFillParameter parameter_REPORT_DATA_SOURCE = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:39: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 private JRFillParameter parameter_REPORT_URL_HANDLER_FACTORY = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:40: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 private JRFillParameter parameter_IS_IGNORE_PAGINATION = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:41: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 private JRFillParameter parameter_REPORT_FORMAT_FACTORY = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:42: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 private JRFillParameter parameter_REPORT_MAX_COUNT = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:43: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 private JRFillParameter parameter_REPORT_TEMPLATES = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:44: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 private JRFillParameter parameter_REPORT_RESOURCE_BUNDLE = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:45: cannot find symbol symbol : class JRFillField location: class classic_1314606689888_793831 private JRFillField field_sach_MaSach = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:46: cannot find symbol symbol : class JRFillField location: class classic_1314606689888_793831 private JRFillField field_sach_TenSach = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:47: cannot find symbol symbol : class JRFillField location: class classic_1314606689888_793831 private JRFillField field_sach_MaNhaXuatBan = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:48: cannot find symbol symbol : class JRFillField location: class classic_1314606689888_793831 private JRFillField field_sach_GiaBan = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:49: cannot find symbol symbol : class JRFillField location: class classic_1314606689888_793831 private JRFillField field_sach_SoLuongTon = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:50: cannot find symbol symbol : class JRFillField location: class classic_1314606689888_793831 private JRFillField field_sach_MaTheLoai = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:51: cannot find symbol symbol : class JRFillVariable location: class classic_1314606689888_793831 private JRFillVariable variable_PAGE_NUMBER = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:52: cannot find symbol symbol : class JRFillVariable location: class classic_1314606689888_793831 private JRFillVariable variable_COLUMN_NUMBER = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:53: cannot find symbol symbol : class JRFillVariable location: class classic_1314606689888_793831 private JRFillVariable variable_REPORT_COUNT = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_13146 INFO: 06689888_793831.java:54: cannot find symbol symbol : class JRFillVariable location: class classic_1314606689888_793831 private JRFillVariable variable_PAGE_COUNT = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:55: cannot find symbol symbol : class JRFillVariable location: class classic_1314606689888_793831 private JRFillVariable variable_COLUMN_COUNT = null; ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:78: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 parameter_REPORT_LOCALE = (JRFillParameter)pm.get("REPORT_LOCALE"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:79: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 parameter_JASPER_REPORT = (JRFillParameter)pm.get("JASPER_REPORT"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:80: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 parameter_REPORT_VIRTUALIZER = (JRFillParameter)pm.get("REPORT_VIRTUALIZER"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:81: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 parameter_REPORT_TIME_ZONE = (JRFillParameter)pm.get("REPORT_TIME_ZONE"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:82: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 parameter_SORT_FIELDS = (JRFillParameter)pm.get("SORT_FIELDS"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:83: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 parameter_REPORT_FILE_RESOLVER = (JRFillParameter)pm.get("REPORT_FILE_RESOLVER"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:84: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 parameter_REPORT_SCRIPTLET = (JRFillParameter)pm.get("REPORT_SCRIPTLET"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:85: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 parameter_REPORT_PARAMETERS_MAP = (JRFillParameter)pm.get("REPORT_PARAMETERS_MAP"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:86: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 parameter_REPORT_CONNECTION = (JRFillParameter)pm.get("REPORT_CONNECTION"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:87: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 parameter_REPORT_CLASS_LOADER = (JRFillParameter)pm.get("REPORT_CLASS_LOADER"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:88: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 parameter_REPORT_DATA_SOURCE = (JRFillParameter)pm.get("REPORT_DATA_SOURCE"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:89: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 parameter_REPORT_URL_HANDLER_FACTORY = (JRFillParameter)pm.get("REPORT_URL_HANDLER_FACTORY"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:90: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 parameter_IS_IGNORE_PAGINATION = (JRFillParameter)pm.get("IS_IGNORE_PAGINATION"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:91: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 parameter_REPORT_FORMAT_FACTORY = (JRFillParameter)pm.get("REPORT_FORMAT_FACTORY"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:92: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 parameter_REPORT_MAX_COUNT = (JRFillParameter)pm.get("REPORT_MAX_COUNT"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:93: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 parameter_REPORT_TEMPLATES = (JRFillParameter)pm.get("REPORT_TEMPLATES"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:94: cannot find symbol symbol : class JRFillParameter location: class classic_1314606689888_793831 parameter_REPORT_RESOURCE_BUNDLE = (JRFillParameter)pm.get("REPORT_RESOURCE_BUNDLE"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:103: cannot find symbol symbol : class JRFillField location: class classic_1314606689888_793831 field_sach_MaSach = (JRFillField)fm.get("sach_MaSach"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:104: cannot find symbol symbol : class JRFillField location: class classic_1314606689888_793831 field_sach_TenSach = (JRFillField)fm.get("sach_TenSach"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:105: cannot find symbol symbol : class JRFillField location: class classic_1314606689888_793831 field_sach_MaNhaXuatBan = (JRFillField)fm.get("sach_MaNhaXuatBan"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:106: cannot find symbol symbol : class JRFillField location: class classic_1314606689888_793831 field_sach_GiaBan = (JRFillField)fm.get("sach_GiaBan"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:107: cannot find symbol symbol : class JRFillField location: class classic_1314606689888_793831 field_sach_SoLuongTon = (JRFillField)fm.get("sach_SoLuongTon"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:108: cannot find symbol symbol : class JRFillField location: class classic_1314606689888_793831 field_sach_MaTheLoai = (JRFillField)fm.get("sach_MaTheLoai"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:117: cannot find symbol symbol : class JRFillVariable location: class classic_1314606689888_793831 variable_PAGE_NUMBER = (JRFillVariable)vm.get("PAGE_NUMBER"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:118: cannot find symbol symbol : class JRFillVariable location: class INFO: classic_1314606689888_793831 variable_COLUMN_NUMBER = (JRFillVariable)vm.get("COLUMN_NUMBER"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:119: cannot find symbol symbol : class JRFillVariable location: class classic_1314606689888_793831 variable_REPORT_COUNT = (JRFillVariable)vm.get("REPORT_COUNT"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:120: cannot find symbol symbol : class JRFillVariable location: class classic_1314606689888_793831 variable_PAGE_COUNT = (JRFillVariable)vm.get("PAGE_COUNT"); ^ C:\Program Files\glassfish-3.1\glassfish\domains\domain1\classic_1314606689888_793831.java:121: cannot find symbol symbol : class JRFillVariable location: class classic_1314606689888_793831 variable_COLUMN_COUNT = (JRFillVariable)vm.get("COLUMN_COUNT"); ^ 61 errors
please help me this regard to generate report
Try adding jasperreports*.jar and any other jar containing classes referenced in the report under glassfish3/glassfish/domains/domain1/lib/ext. Restart the app server.
Regards
It seems that the JasperReport library is missing. The latest version of JasperReports can be downloaded here http://sourceforge.net/projects/jasperreports/files/jasperreports/JasperReports%204.5.0/
Add the jar file to your project and redeploy.
Make sure you have the required dependencies as well: http://www.installationwiki.org/JasperReports
You will need to add JDT libraries in the classpath of your application. (WEB-INF/lib)
jdtcore and jdt-compiler
At the time of this writing versions 3.1.0 and 3.1.1 respectively will work for jasperreports 4.7.0.
This error happens only in glassfish as far as I now. In tomcat this problem does not occur.
Jasper FAQ: When should I compile my report templates and how?
I have also the same errors, but when using with Groovy and Jasperreports. I get these errors:
net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
/home/avorsterman/dev/prj/groovy/page1_1641570877927_139275.java:18: error: cannot find symbol
public class page1_1641570877927_139275 extends JREvaluator
^
symbol: class JREvaluator
/home/avorsterman/dev/prj/groovy/page1_1641570877927_139275.java:25: error: cannot find symbol
private JRFillVariable variable_PAGE_NUMBER = null;
^
symbol: class JRFillVariable
location: class page1_1641570877927_139275
/home/avorsterman/dev/prj/groovy/page1_1641570877927_139275.java:4: error: package net.sf.jasperreports.engine does not exist
import net.sf.jasperreports.engine.*;
^
/home/avorsterman/dev/prj/groovy/page1_1641570877927_139275.java:5: error: package net.sf.jasperreports.engine.fill does not exist
import net.sf.jasperreports.engine.fill.*;
^
/home/avorsterman/dev/prj/groovy/page1_1641570877927_139275.java:64: error: cannot find symbol
variable_PAGE_NUMBER = (JRFillVariable)vm.get("PAGE_NUMBER");
^
symbol: class JRFillVariable
location: class page1_1641570877927_139275
5 errors
After adding this dependency to the project the errors are fixed:
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<version>4.6.1</version>
</dependency>
精彩评论