JasperReports CompileReport

I am writing an example application for creating a report using JasperReports. As a java desktop application, I can take a template and convert it to a report without any problems. However [with the same library sets] I cannot do this under Glassfish [like a servlet].

I get a lot of errors when compiling the report.

String jrFile = "/WEB-INF/HelloWorld.jrxml";
InputStream irs = getServletConfig().getServletContext().getResourceAsStream(jrFile);
JasperReport jr = JasperCompileManager.compileReport(irs);

Many of the reported errors:

net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:

package net.sf.jasperreports.engine.fill does not exist
import net.sf.jasperreports.engine.fill.*;

With the exception of:

61 errors

    at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:191)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:215)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:201)
+3
source share
2 answers

I missed JDT - *. jar in my classpath. Once this was added, the errors disappeared.

+2
source
+4

Source: https://habr.com/ru/post/1783272/


All Articles