One more thing: After I run this servlet, I will get a java.lang.OutOfMemoryError when I try to display another web page.
Here is my code about FOP: public static final String XSLFILE = "/hr/xsl/jobdesc.xsl"; protected Logger log = null; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ........... if (log == null) { log = new ConsoleLogger(ConsoleLogger.LEVEL_INFO); MessageHandler.setScreenLogger(log); } try { ............... String fullPath = getServletContext().getRealPath( XSLFILE ); File xslfile = new File(fullPath); // create StreamSource for XSLT document Source xslSource = new StreamSource( xslfile ); // create DOMSource for source XML document Source xmlSource = new DOMSource( jobDocument ); renderBrowser(xmlSource, xslSource, response ); } // catch XML parser exceptions catch ( ParserConfigurationException pcException ) { pcException.printStackTrace(); } catch (ServletException ex) { throw ex; } catch (Exception ex) { throw new ServletException(ex); } } private void renderBrowser( Source xmlSource, Source xslSource, HttpServletResponse response ) throws ServletException { try { //Construct driver Driver driver = new Driver(); //Setup logger & Renderer (output format) driver.setLogger(log); driver.setRenderer(Driver.RENDER_PDF); //Setup output ByteArrayOutputStream out = new ByteArrayOutputStream(); driver.setOutputStream(out); // create TransformerFactory to obtain a Transformer TransformerFactory transformerFactory = TransformerFactory.newInstance(); // create Transformer for performing XSL transformation Transformer transformer = transformerFactory.newTransformer( xslSource ); //Resulting SAX events (the generated FO) must be piped through to FOP Result result = new SAXResult(driver.getContentHandler()); // perform transformation and deliver content to client transformer.transform( xmlSource, result ); byte[] content = out.toByteArray(); response.setContentType("application/pdf"); response.setContentLength(content.length); response.getOutputStream().write(content); response.getOutputStream().flush(); } // handle exception when transforming XML document catch ( TransformerException transformerException ) { transformerException.printStackTrace( System.err ); } catch (Exception ex) { throw new ServletException(ex); } } I really need help to fix this problem. Thanks Judy Cai -----Original Message----- From: Jeremias Maerki [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 8:32 AM To: [EMAIL PROTECTED] Subject: Re: embedding fop0.20.5 working on jdk1.3.1-linux? Try to find out if anything is logged in the Tomcat Logs. If not try to set your own logger for FOP: [1] http://xml.apache.org/fop/embedding.html#basic-logging [2] http://xml.apache.org/fop/embedding.html#logging If your Linux is running in a headless environment (no X subsystem) then the following link may help: http://xml.apache.org/fop/graphics.html#batik Good luck! On 15.09.2003 22:54:30 Cai, Judy wrote: > I have a java servlet to generate a PDF page using > fop0.20.5. It works fine in the windows XP ( jdk1.4.1 on tomcat-4.1.24 > server). But when I moved to Open BSD with jdk1.3.1-linux on tomcat-4.1.24, > there was nothing to display, no any error or exception, just blank page. > > I was exhausted to figure it out. Will anybody tell me some > experience working fop on jdk1.3.1-linux? Jeremias Maerki --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]