Hi!

I have a following problem. I have a stamping application to place a stamp in the PDF document. While everything in Windows works great, when I upload it to a machine running Tomcat (to stamp the documents generated on-the-fly), I get an error... Here it is:

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet execution threw an exception
                com.sfs.filter.CacheControlFilter.doFilter(CacheControlFilter.java:47)

root cause

java.lang.NoClassDefFoundError
                com.lowagie.text.pdf.PdfGraphics2D.<init>(Unknown Source)
                com.lowagie.text.pdf.PdfContentByte.createGraphics(Unknown Source)
                com.sfs.pdf.writer.pdf.ITextPdfWriter.newFile(ITextPdfWriter.java:83)
                com.sfs.pdf.aerodromes.ADListCreator.createNewPDFWriter(ADListCreator.java:197)
                com.sfs.pdf.aerodromes.ADListCreator.createDocumentWidthSingleChapter(ADListCreator.java:410)
                com.sfs.servlet.ADListCreatorServlet.createAndSendPdfDocument(ADListCreatorServlet.java:330)
                com.sfs.servlet.ADListCreatorServlet.createAerodromeADList(ADListCreatorServlet.java:224)
                com.sfs.servlet.ADListCreatorServlet.processGet(ADListCreatorServlet.java:168)
                com.sfs.servlet.AbstractServlet.doGet(AbstractServlet.java:129)
                javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
                javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
                com.sfs.filter.CacheControlFilter.doFilter(CacheControlFilter.java:47)

The bolded line points to this function:
        public boolean newFile(OutputStream outputStream, float height, float width, String author, String title, String subject) {
               
                coord=new PDFCoordinates(width, height);
                document = new Document();

                try {
                        writer = PdfWriter.getInstance(document, outputStream);
                       
                        document.addAuthor(author);
                        document.addSubject(subject);
                        document.addTitle(title);

                        pageWidth = width;
                        pageHeight = height;

                        document.open();

                        pdfContentByte = writer.getDirectContent();
                        pdfTemplate = pdfContentByte.createTemplate(pageWidth, pageHeight);
                        g2D = pdfTemplate.createGraphics(pageWidth, pageHeight);

                } catch (DocumentException e) {
                        System.out.println(e.getMessage());
                        return false;
                }

                return true;
        }

Is it possible that while running on tomcat the iText has a problem creatingGraphics and returning an object Graphics2D... or is the problem two lines before, getting the DirectContent? Either way is there a workaround, how would i go about fixing this....

Thanks!

cierech

Reply via email to