Reputation: 14234
I'm writing a sample application to create a report using JasperReports. As a desktop java app [jar] I'm able to take an template and convert it into a report without an issue. However [with the same libraries set] I'm not able to do this under Glassfish [as an servlet].
I'm getting lots of errors when the report is being compiled.
String jrFile = "/WEB-INF/HelloWorld.jrxml";
InputStream irs = getServletConfig().getServletContext().getResourceAsStream(jrFile);
JasperReport jr = JasperCompileManager.compileReport(irs);
Many of the errors reported are:
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.*;
Under the exception:
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)
Upvotes: 3
Views: 2950
Reputation: 71
yes it was very useful you can download jdt-compiler3.1.1.jar file from following link http://sourceforge.net/projects/jasperreports/files/jasperreports/JasperReports%203.5.3/jasperreports-3.5.3-project.zip/download
you need to download jasperreports-3.5.3-project.zip file and take jdt-compiler3.1.1.jar from lib folder and add it to your project it will start working.
Upvotes: 4
Reputation: 14234
I lacked the JDT-*.jar in my classpath. Once that was added, then the errors went away.
Upvotes: 2