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

Virtualizer JRxlsExporter: ClassCastException


Recommended Posts

By: frblusso - frblusso

Virtualizer JRxlsExporter: ClassCastException

2006-02-21 08:08

hello

I use jasper1.2.0

if I export in a xls format via JRXlsExporter, using virtualizer, I have this exception in a websphere 5.1 environnment:

 

[21/02/06 16:40:42:769 CET] 6398133f WebGroup E SRVE0026E: [Erreur de servlet]-[net.sf.jasperreports.engine.base.JRVirtualPrintPage$JRIdHolderTemplateElement]: java.lang.ClassCastException: net.sf.jasperreports.engine.base.JRVirtualPrintPage$JRIdHolderTemplateElement

at net.sf.jasperreports.engine.fill.JRTemplatePrintText.isStyledText(JRTemplatePrintText.java:291)

at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.getStyledText(JRXlsAbstractExporter.java:422)

at net.sf.jasperreports.engine.export.JRXlsExporter.exportText(JRXlsExporter.java:276)

at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportPage(JRXlsAbstractExporter.java:367)

at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportReportToStream(JRXlsAbstractExporter.java:289)

at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportReport(JRXlsAbstractExporter.java:135)

at com.airfrance.reporting.action.BenchAction.exportReportToBytes(BenchAction.java:448)

at com.airfrance.reporting.action.BenchAction.benchJasper(BenchAction.java:390)

at com.airfrance.reporting.action.BenchAction.lancerBench(BenchAction.java:140)

------------

the problem happens only if i use the virtalizer.

here is the java code i use to export to excel.

-------

JasperPrint jasperPrint = JasperFillManager.fillReport(name, parameters, dataSource);

virtualizer.setReadOnly(true);

response.setContentType("application/vnd.ms-excel");

JRXlsExporter exporter = new JRXlsExporter();

output = exportReportToBytes(jasperPrint, exporter);

-----

and

---

private byte[] exportReportToBytes(JasperPrint jasperPrint, JRExporter exporter) throws JRException {

ByteArrayOutputStream baos = new ByteArrayOutputStream();

exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);

exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);

exporter.exportReport();

return baos.toByteArray();

}

 

could you help me, please?

 

 

 

 

 

 

 

By: Lucian Chirita - lucianc

RE: Virtualizer JRxlsExporter: ClassCastExcep

2006-02-23 01:47

Hello

 

Using a virtualzier with the XLS exporter doesn't actually make sense unless JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET is set. When IS_ONE_PAGE_PER_SHEET is not set, the exporter creates a huge page by concatenating all the pages in the report, therefore keeping the entire report in memory.

 

We'll try to find a solution for this. In the mean time, you can either set IS_ONE_PAGE_PER_SHEET or not use a virtualizer.

 

Regards,

Lucian

Link to comment
Share on other sites

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

Top Posters In This Topic

  • 5 weeks later...

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