I was checking the following question JasperReports fillReport too slow and resource consuming and I tried to apply the verfied answer but couldn't notice any change in the generation of my reports.
Basicaly what I'm trying to do is to change the xpath executer factory for JasperFillManager to use Jaxen instead of Xalan but I can't seem to know where I should place the following line in my code
DefaultJasperReportsContext context = DefaultJasperReportsContext.getInstance();
JRPropertiesUtil.getInstance(context).setProperty("net.sf.jasperreports.xpath.executer.factory",
"net.sf.jasperreports.engine.util.xml.JaxenXPathExecuterFactory");
My code block looks as follows
private JasperPrint getJasperPrintInstance(JasperReport report) throws JRException, NamingException, SQLException {
JasperPrint jasperPrint = null;
DefaultJasperReportsContext context = DefaultJasperReportsContext.getInstance();
JRPropertiesUtil.getInstance(context).setProperty("net.sf.jasperreports.xpath.executer.factory",
"net.sf.jasperreports.engine.util.xml.JaxenXPathExecuterFactory");
if (dataSource == null) {
jasperPrint = JasperFillManager.fillReport(report, this.reportParams, connection);
} else {
jasperPrint =
JasperFillManager.fillReport(report, this.reportParams,
new JRBeanCollectionDataSource(getDataSource()));
}
return jasperPrint;
}
Even when I change "net.sf.jasperreports.engine.util.xml.JaxenXPathExecuterFactory" to anything else nothing changes.
Can you please let me know what I may be doing wrong?