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

Export function was hung when export huge-report


jmikel

Recommended Posts

Hi all

I 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

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

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