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

report export error after update JasperReports


sjongenelen

Recommended Posts

I've recently upgraded JasperReports on my JasperServer (pro) from 3.5.0 to 3.6.1 (from iReport).

this worked suprisingly well :D

I have updated the following Jar's:
jasperreports-chart-themes-3.5.3.jar
jasperreports-3.6.1.jar
jasperreports-extensions-3.5.3.jar
jasperreports-fonts-3.6.1.jar

I placed them into
"C:\Program Files\jasperserver-pro-3.5.1\apache-tomcat\webapps\jasperserver-pro\WEB-INF\lib"

I have removed the following Jar's:
jasperreports-3.5.0-Mondrian-3.1.1.jar
jasperreports-chart-themes-3.5.0.jar
jasperreports-ofc-component-0.0.2.2.jar

Since this update, all my reports are no long exportable to MS Excel! All other exports work, but Excel gives the following error:

Error Trace

java.lang.NullPointerException

 

 

Link to comment
Share on other sites

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

Hi, I got same error but using runtime generation with jasperReport :

It seem work fine only setting the parameter for the exporter (JRXlsExporter) : JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET to TRUE

If I try to set the parameter to FALSE I get the same error as sjongenelen. 

 

Link to comment
Share on other sites

Folks,

 

You can't expect updating the JasperReports jars to work. There are many parts of the server that depend on the JasperReports APIs and they change slightly from version to version. Jaspersoft cannot support you if you do this.

 

 

Sherman

Jaspersoft

Link to comment
Share on other sites

Hi Sherman,
I don't use Jasper Server but i've got the same error of sjongenelen. I had downloaded jasperReport 3.6.1. I use Struts 2 framework but i don't use the struts plugin for jasperReport

I think that may be there is a problem in the jasperReport 3.6.1

This is the error that i got

16 nov 2009 09:23:07,791 ERROR http-8080-Processor24  test.JReportAction -
java.lang.NullPointerException
    at net.sf.jasperreports.engine.export.CutsInfo.isCutNotEmpty(CutsInfo.java:147)
    at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.setColumnWidths(JRXlsAbstractExporter.java:662)
    at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportReportToStream(JRXlsAbstractExporter.java:453)
    at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportReport(JRXlsAbstractExporter.java:185)
    at it.mito.sapi.action.MitoReportActionSupport.getReportStream(MitoReportActionSupport.java:144)
    at it.mito.sapi.action.test.JReportAction.execute(JReportAction.java:65)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method).....

 

If i change the value of JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET from false to true and it work fine.

I forget something in the code?!

Do you have any suggestions for me?
 
thanks in advance
 

Marciux.

Code:
//Gets the JasperPrintJasperPrint jasperPrint = JasperFillManager.fillReport(reportInputStream, getReportParams(), dataSource);JRAbstractExporter exporter = null;switch (reportType) {        case XLS:            exporter = new JRXlsExporter();//Create XLS Exporter             exporter.setParameter(JRXlsExporterParameter.OFFSET_X, 0);               //this work fine                    //exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);            //TODO : get error, fix problem            exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);                        exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);                      exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);            break;        case PDF:            exporter = new JRPdfExporter();//Create PDF Exporter            break;        case CSV:            exporter = new JRCsvExporter();//Create CSV Exporter            break; }//Output Stream for exporterByteArrayOutputStream baou = new ByteArrayOutputStream(1024);//Sets the output streamexporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baou);   //Sets the jasper printexporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);           //Export the reportexporter.exportReport();//Returns the report input streamreturn new ByteArrayInputStream(baou.toByteArray());
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...

There seems to be a bug with the JRXlsExporter, when I exported a report using it, an error message appeared saying there was a problem with the file, that it could be incomplete or something (and indeed it was). I couldn't find a solution using the JRXlsExporter, but i found a workaround, you should try using the class JExcelApiExporter instead of a JRXlsExporter:

in JAVA:

JExcelApiExporter exp = new JExcelApiExporter();
          exp.setParameter(JRExporterParameter.JASPER_PRINT, jprint);
          exp.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, reportPath + fileReportName);
          exp.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
          exp.setParameter(JRXlsExporterParameter.IS_COLLAPSE_ROW_SPAN,Boolean.TRUE);
          exp.exportReport();

in iReport:

Go to the Preview tab and select "Xls Preview (Using JExcelApi)".

 

Hope this helps,

 

C.Chiappe

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