diff --git a/src/main/java/info/bukova/isspst/reporting/PredefinedGenerator.java b/src/main/java/info/bukova/isspst/reporting/PredefinedGenerator.java index ec620509..8bfac506 100644 --- a/src/main/java/info/bukova/isspst/reporting/PredefinedGenerator.java +++ b/src/main/java/info/bukova/isspst/reporting/PredefinedGenerator.java @@ -4,6 +4,9 @@ import java.io.File; import javax.servlet.ServletContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.JasperRunManager; @@ -16,6 +19,7 @@ public class PredefinedGenerator implements Generator { private ReportDefinition definition; private ServletContext ctx; + private final static Logger logger = LoggerFactory.getLogger(PredefinedGenerator.class); public PredefinedGenerator(ReportDefinition definition, ServletContext ctx) { this.definition = definition; @@ -30,8 +34,10 @@ public class PredefinedGenerator implements Generator { JasperReport report = (JasperReport) JRLoader.loadObject(getReportFile()); JRProperties.setProperty("net.sf.jasperreports.default.pdf.encoding", "Cp1250"); loadLazyData(); + definition.setParam("SUBREPORT_DIR", ctx.getRealPath("WEB-INF/reports") + "/"); bytes = JasperRunManager.runReportToPdf(report, definition.getParams(), new JRBeanCollectionDataSource(definition.getDataSet()));; } catch (JRException e) { + logger.error("Generator error: " + e.getMessage()); throw new ReportException(e); }