Error: Linux + PDF Generation

By: Jon Klem - jkle44
Error: Linux + PDF Generation
2003-11-20 15:23
I've trolled all available posts to see if anybody was having a similar problem but was unable to find a match.

We are using jasperreports .5 and iText 1.01 on RH 8/Tomcat 4.1. Our site makes heavy use of PDF generation using jasperrepots. After several days of usage (following a tomcat restart), the pdf generation starts failing, not always in the same way though.

Since upgrading the jasper .5 and iText 1.01 the problems appeared to have gone away but now, after a week of trouble-free performance they reappeared.

More of the stacktrace is included at the bottom of this post but the message we get is "ExceptionConverter: The document has no pages."

Problems we've had debugging this:

1) This solution seemed to work fine on a previous Tomcat3/Sun Solaris host (ran without ever encountering these problems)

2) We either email the PDF or send it to the screen as a preview. The preview functionality never fails. It is using basically the same code to generate the PDF. We are just redirecting the stream to the screen instead of using it to construct an email.

3) This only happens on our Linux host (never during Windows 2K development) under heavy load so it is difficult to reproduce and even harder to debug. The rest of the site functions without problems even after the PDF generation has entered into this volatile state.

4) Restarting tomcat always fixes the problem, at least temporarily.

Any help or direction would be greatly appreciated. I would be loathe to have to abandon this great software over this thorny issue.


Jon Klem

ExceptionConverter: The document has no pages.
at com.lowagie.text.pdf.PdfPages.writePageTree(Unknown Source)
at com.lowagie.text.pdf.PdfWriter.close(Unknown Source)
at com.lowagie.text.pdf.PdfDocument.close(Unknown Source)
at com.lowagie.text.Document.close(Unknown Source)
at dori.jasper.engine.export.JRPdfExporter.exportReportToStream(
at dori.jasper.engine.export.JRPdfExporter.exportReport(
at dori.jasper.engine.JasperExportManager.exportReportToPdf(
at dori.jasper.engine.JasperRunManager.runReportToPdf(

By: Paulo Soares - psoares33
RE: Error: Linux + PDF Generation
2003-11-25 07:15
The exception you see is the consequence not the cause. It says that you have a document without anything written, something happened before. Check for cought exceptions that output no messages and the System.out and System.err logs.

By: Teodor Danciu - teodord
RE: Error: Linux + PDF Generation
2003-11-28 12:53


We had this problem on a previous version of
JasperReport and Paulo provided us with the solution:

The fix was added in the 0.5.0 version, but I'm afraid
I did not handle all the situations.
If I understand correctly, with recent versions of
iText we cannot create PDF documents witout any
page inside anymore.

I think in your case, from time to time,
your application creates empty documents probably
due to the fact that there are no records in the data
source of the report and you have whenNoDataType="NoPages", which is the default.

One solution is to use whenNoDataType="BlankPage".
But I think we should also fix the PDF exporter to
create at least one page even when the JasperPrint
object has no pages inside.

Thank you,
2002 JI Open Discussion's picture
Joined: Aug 10 2006 - 3:28am
Last seen: 16 years 7 months ago

0 Answers:

No answers yet