I use apache fop in a servlet to display some xml as pdf. When I have used that functionality in my webapp my (Tomcat 6.0) web container doesn't want to undeploy. It deletes everything in the webapps/*context* directory except WEB-INF/lib/batik.jar and WEB-INF/lib/fop.jar. When trying to delete the files manually windows tells me they are in use.
I use this code to render the xml into pdf ByteArrayOutputStream out = new ByteArrayOutputStream(); FopFactory ff=FopFactory.newInstance(); TransformerFactory tf=TransformerFactory.newInstance(); StreamSource xslfo=new StreamSource(this.getServletContext().getRealPath("lid-pdf.xsl")); try { Transformer tt=tf.newTransformer(xslfo); Fop fp=ff.newFop(MimeConstants.MIME_PDF, out); SAXResult res=new SAXResult(fp.getDefaultHandler()); Source src= new DOMSource(doc); DOMResult dd=new DOMResult(); assert(src!=null); assert(res!=null); tt.transform(src, dd); Transformer t2=tf.newTransformer(); // System.out.println(res.getNode().getFirstChild()); t2.transform(new DOMSource(dd.getNode()), res ); //Prepare response response.setContentType("application/pdf"); assert(out.size()>0); response.setContentLength(out.size()); // System.out.println(Version.getVersion()); //Send content to Browser response.getOutputStream().write(out.toByteArray()); response.getOutputStream().flush(); out.close(); } catch (FOPException e) { // TODO Auto-generated catch block throw new ServletException(e); } catch (TransformerConfigurationException e1) { // TODO Auto-generated catch block throw new ServletException(e1); } catch (TransformerException e) { // TODO Auto-generated catch block throw new ServletException(e); } System.gc(); Anyone has any ideas? Roel -- View this message in context: http://www.nabble.com/apache-fop-remains-active-in-servlet-environment-tf4896511.html#a14023743 Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]