jmikel Posted March 26, 2014 Share Posted March 26, 2014 Hi allI have a problem when export a huge-report (size 4GB)I used JRVirtualizer to fill report, and it worked sucessfully. I could get the JasperPrint object after filled the report.But when i export the JasperPrint object out to PDF or XML. It was hung and i couldn't get the report output after a long time.Below is my code to export:private void export(JRExporter exporter) throws JRException, IOException, ClassNotFoundException { JRVirtualizer virtualizer = new AJVirtualizer(); JRVirtualizationHelper.setThreadVirtualizer(virtualizer); //Get JasperPrint object after filled report AJPersistenceManager pmgr = new AJPersistenceManager(); JasperPrint print = pmgr.readPrintFromFile(prtFileName, startPage, endPage); exporter.setParameter(JRExporterParameter.JASPER_PRINT, print); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, this.ostream); exporter.setParameter(JRExporterParameter.CHARACTER_ENCODING, contentEncoding); exporter.setParameter(AJExporterParameter.REPORT_FILE_NAME, dbFileName()); setOutputPages(exporter); //When perform this function, it was hung at here exporter.exportReport(); JRVirtualizationHelper.clearThreadVirtualizer(); virtualizer.cleanup(); this.contentEncoding = (String)exporter.getParameter(JRExporterParameter.CHARACTER_ENCODING); }private void setOutputPages(JRExporter exporter) { if (startPage != -1) { if (endPage == startPage) { exporter.setParameter(AJExporterParameter.TRUE_PAGE_NUMBER, startPage); } else { exporter.setParameter(AJExporterParameter.TRUE_START_PAGE, startPage); exporter.setParameter(AJExporterParameter.TRUE_END_PAGE, endPage); } } exporter.setParameter(AJExporterParameter.REPORT_NUM_PAGES, numPages); } [/code]Who did get this problem like me? If you have any idea, please give me your comments and how can i solve this issue?I use JasperReport 5.0.1 Thanks and best regards,Tai Hoang Link to comment Share on other sites More sharing options...
hozawa Posted March 27, 2014 Share Posted March 27, 2014 Just have to divide your reports into parts and export the parts. Use parameters to divide the reports.The other option is to add more memory but if the report is really large, it still hangs up. Link to comment Share on other sites More sharing options...
jmikel Posted March 27, 2014 Author Share Posted March 27, 2014 Hi hozawa.Thanks for your help.I tried divide my reports into multi sub-reports (>1000 subreports). I still use this function for each sub-report to export data. But it still hangs when export for report No. 589.I guess this problem come from java heap memory exception. I still not get any exception. I tried with small report and it executed sucessfully. I set memory for Tomcat at: -xms64M -xmx3072M. I want to export into the OutputStream before i save it into a pdf file.What should i do for my app? I need execute e huge-report.Thanks,Tai Hoang Link to comment Share on other sites More sharing options...
hozawa Posted March 27, 2014 Share Posted March 27, 2014 I'm not talking about using reports. I meant dividing your data records into several parts. We also encountered this problem when exporting to excel and we just limited the number of records using parameters and running the report several times. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now