开发者

"HTTP Status 404 - result 'null' not found" exporting XLS with JasperReport's Web Services (May have nothing to do with Jasper)

(There is a chance that this has nothing to do with Jasper, but it only happens with my web services implementation, NOT with the normal JasperServer interface)

I have implemented web services and when I export to XLS I am seeing very strange behavior (no problems with XLSX, CSV, PDF). When the report returns a small number results it will not export. Instead my browser gives: "HTTP Status 404 - result 'null' not found". When there are a large number of results it will export correctly. I have been unable to find a log messages that give any hints.

So I removed all report bands except for the details and was able to determine that 43 or more rows will export XLS correctly, but 42 or less will cause the error. I figured this out by process of elimination changing my query from "select TOP 10 ..." to "select TOP 20 ..." to "select TOP 30 ...", etc, etc etc. 43 is a strange number so I thought it might have to do with pixels. I played with the number of pixels on my details band and of the entire report, but the 42 vs 43 row problem persisted.

At this time my report was displaying three fields, so I removed two of them ran the report and the problem returned. I didn't bother honing in on the exact number of rows, but now the magic number was somewhere between 60 and 80 rows.

You can see a snippet of my code here: http://pastebin.com/MyPYMju4

        JasperPrint print; = client.runReport(rd, reportInputMap);
  开发者_运维知识库      response.setHeader("Content-Disposition", " inline; filename=report" + (new Date()).getTime() + "." + format.toLowerCase());
        JRAbstractExporter myExporter;

        /// ... if/else code to determine what file to export to ...

        myExporter = new JRXlsExporter();
        response.setContentType(FORMAT_CONTENTTYPE_MAP.get(format));
        myExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, response.getOutputStream());
        myExporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
        myExporter.exportReport();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜