Jump to content

Recommended Posts

Posted

I want to compile a .JRXML file with an XML Datasource in Java. It works perfectly within iReport. In Java, it does not work.

When I set the main query language to 'xpath', the report is generated, but with no xml data in it.

With 'xpath2' as the main query language, I get an error "No query executer factory registered for the 'xpath2' language" and the report is not being generated.

It doesn't even work with the simplest report you can think of.

What I've tried so far:

  • Checked for the following line in jasperreports.properties:
    net.sf.jasperreports.query.executer.factory.xpath2=com.jaspersoft.jrx.query.JRXPathQueryExecuterFactory
  • Checked for the .jar file "jasperreports-extensions-3.5.3.jar" in my applications classpath
  • Added this line to my Java code:
    jasperReport.setProperty("net.sf.jasperreports.query.executer.factory.xpath2", "com.jaspersoft.jrx.query.JRXPathQueryExecuterFactory");
  • Set the XML Datasource in Java:
    org.w3c.dom.Document document = JRXmlUtils.parse(JRLoader.getLocationInputStream(args[2]));
    params.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document);

My report generation code:

JasperReport jasperReport = JasperCompileManager.compileReport(args[0]);

JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, new JREmptyDataSource());

JasperExportManager.exportReportToPdfFile(jasperPrint, args[1]);

I appreciate your help.

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...