Jump to content
We've recently updated our Privacy Statement, available here ×

XML datasource problem


vsmadhu

Recommended Posts

Hi

       I have used the below method to export PDF report from a java program.  it takes about 5 mins to return a 25 page report.

        iReports returns the results in like 15 to 20 Sec on the same machine the time in SOP before and after returned 5 min in JasperFillManager.fillReport 

 Any idea why there is ssuch a huge differenece between iReport Exproting and Exproting from a java program ?

 

          public byte[] runReportForPDF(String passedFilePath, String reportName,
      String reportXpath, HashMap parameters,BufferedInputStream buff) throws JRException {
    JRXmlDataSource xmlDataSource = null;
    JasperPrint jprint = null;
    JasperReport jasperReport = null;
    InputStream inputStream = null;
    try{
     
      System.out.println("Printing All METHOD_PARAMETER_VALUE PDF "+passedFilePath+" /"+reportName+" /"+reportXpath+" /"+parameters);
      xmlDataSource = getXMLDataSource(buff,reportXpath);
      passedFilePath = passedFilePath.concat(reportName);
      System.out.println(passedFilePath);
      inputStream = JRLoader.getLocationInputStream(passedFilePath);
     
      jasperReport = (JasperReport) JRLoader.loadObject(inputStream);
      System.out.println("Time Before Filling the PDF reprot "+ Calendar.getInstance().getTime());
      jprint = JasperFillManager.fillReport(jasperReport,parameters, xmlDataSource);
      System.out.println("Time After Filling the PDF reprot "+ Calendar.getInstance().getTime());

      /*
       * Closing all the connections/variables used*/
      if (inputStream != null){
          inputStream.close();
          inputStream = null;
      }

    }catch(Exception e){
      e.getLocalizedMessage();
      e.printStackTrace();     
    }
    return ((byte[])JasperExportManager.exportReportToPdf(jprint));
  }
 



Post Edited by vsmadhu at 06/09/2010 17:50
Link to comment
Share on other sites

  • 2 months later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Use of Jaxen jar instead of xalan solved the problem.

Jaxen is also included in the jasper download.

Change the value in jasperreports-(your-version).jar

file name default.jasperreports.properties

search for

net.sf.jasperreports.xpath.executer.factory=

comment it (Just for backup)

and add a new line like

net.sf.jasperreports.xpath.executer.factory=net.sf.jasperreports.engine.util.xml.JaxenXPathExecuterFactory

Link to comment
Share on other sites

  • 1 year later...

i got an error

Caused by: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Class "net.sf.jasperreports.engine.util.xml.JaxenXPathExecuterFactory" should be compatible with "net.sf.jasperreports.engine.query.JRQueryExecuterFactory"
 

what's my mistake ?

can someone help me

regards,

Mathias

Link to comment
Share on other sites

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...