I am encountering a java.lang.ClassCastException in my application when using iText 2.2 to sign and stamp certain PDF documents. The error occurs intermittently when processing PDFs that include tables and have more than 4 pages. After rebooting the Tomcat server where the app is deployed, it works again. The relevant part of the stack trace is as follows:
java.lang.ClassCastException: com.lowagie.text.pdf.PdfDictionary cannot be cast to com.lowagie.text.pdf.PRIndirectReference
at com.lowagie.text.pdf.PdfReader.eliminateSharedStreams(PdfReader.java:2233) ~[itext-2.2.jar:?]
at com.lowagie.text.pdf.PdfReader.readPdf(PdfReader.java:521) ~[itext-2.2.jar:?]
at com.lowagie.text.pdf.PdfReader.<init>(PdfReader.java:184) ~[itext-2.2.jar:?]
at com.lowagie.text.pdf.PdfReader.<init>(PdfReader.java:173) ~[itext-2.2.jar:?]
...
We are using iText 2.2 to stamp some data on PDF files. In some of these documents, which include tables and more than 4 pages, intermittent errors occur that we cannot explain. Any insights on how to resolve this issue would be greatly appreciated.
Cannot reproduce the error even with the same PDF file. Tomcat server reboot makes it work again.
I expect to work with any PDF without any problem.
AccOUCH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2