running FOP multiple times, at one tomcat server(and one JVM) (IMPORTANT)
Hello, I run FOP from a JSP page, at Tomcat webserver. It works fine, til there is only one user at a time. But if 2 users want to use the fop converter at the same time, it fails, and says: type Exception report message Internal Server Error description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request. exception javax.servlet.ServletException: duplicate class definition: org/apache/xalan/processor/TransformerFactoryImpl at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:457) at org.apache.jsp.dmConvertXML2PDF$jsp._jspService(dmConvertXML2PDF$jsp.java:174) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106) at java.lang.Thread.run(Thread.java:484) root cause java.lang.LinkageError: duplicate class definition: org/apache/xalan/processor/TransformerFactoryImpl at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:486) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111) at java.net.URLClassLoader.defineClass(URLClassLoader.java:248) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at org.apache.catalina.loader.StandardClassLoader.findClass(StandardClassLoader.java:671) at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:1090) at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:989) at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:1073) at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:989) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1293) at
Re: running FOP multiple times, at one tomcat server(and one JVM) (IMPORTANT)
thanks, but i solved the problem. i had to put these row, into my FOP executer method: org.apache.fop.messaging.MessageHandler.setID(true); BR, Fishy J.Pietschmann wrote: Fischer Tibor wrote: I run FOP from a JSP page, at Tomcat webserver. It works fine, til there is only one user at a time. But if 2 users want to use the fop converter at the same time, it fails, and says: ... javax.servlet.ServletException: duplicate class definition: org/apache/xalan/processor/TransformerFactoryImpl This is a problem with the Tomcat classloader loading a Xalan class. It has absolutely nothing to do with FOP. Ask the Tomcat people for help. If you are using Tomcat 4.0.3, they'll probably tell you to try 4.0.4b2. Another possibility is that you have JDK1.4 or for some other reason two different Xalan instances in the classpath(es). J.Pietschmann
bookmark
Hello, How can i put entries into the bookmark of the pdf?? Thanks BR, Fishy
Re: problems with creating pdf
what version of FOP do you use? try this code. it works perfectly with 0.20.3 FOP public static void execWFop(String xmlFile, String xslFile, String outputFile){ try{ try { javax.xml.transform.stream.StreamSource xmlSource=new javax.xml.transform.stream.StreamSource(new java.io.File(xmlFile)); javax.xml.transform.stream.StreamSource xslSource=new javax.xml.transform.stream.StreamSource(new java.io.File(xslFile)); javax.xml.transform.Transformer transformer=javax.xml.transform.TransformerFactory.newInstance() .newTransformer(xslSource); transformer.setURIResolver(new TTURIResolver()); org.apache.fop.apps.Driver driver=new org.apache.fop.apps.Driver(); driver.setOutputStream(new java.io.FileOutputStream(outputFile)); driver.setRenderer(org.apache.fop.apps.Driver.RENDER_PDF); transformer.transform(xmlSource, new javax.xml.transform.sax.SAXResult(driver.getContentHandler())); System.exit(2); } catch( Exception e ) { e.printStackTrace(System.out); } } BR, Fishy Marianne von den Driesch und Viktor Goebel wrote: We have the following problem using FOP: First we tried to embed FOP into a small java programm: package TestPackage; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; import org.apache.fop.apps.Driver; import org.apache.fop.apps.Version; import org.apache.fop.apps.*; import org.apache.log.*; public class Test { public static void main(String[] args) throws Exception { File fxml=new File(D:\\xslfoRef.xml); File fxsl=new File(D:\\xml2pdf.xsl); File fpdf=new File(D:\\ttt.pdf); Logger log; Hierarchy hierarchy = Hierarchy.getDefaultHierarchy(); log = hierarchy.getLoggerFor(fop); log.setPriority(Priority.WARN); Driver dr=new Driver(); dr.setLogger(log); dr.setRenderer(Driver.RENDER_PDF); InputHandler ih=new XSLTInputHandler(fxml,fxsl); XMLReader p=ih.getParser(); dr.setOutputStream(new FileOutputStream(fpdf)); dr.render(p,ih.getInputSource()); } } The program can be compiled without any problems, but the pdf-file has 0 bytes. What is wrong? We tried also to start FOP from the command line under dos and linux with the parameters xslfoRef.xml and xml2pdf.xsl. The error message was : Master -reference for fo:page -sequence matches no simple -page -master or page -sequence -master. Do you have any idea?? Thanks for your help, Viktor und Marianne.
Re: to Fisher Tibor
sorry, just comment out that line it should work without that. if not i send you that class too. i dont think you need that. Br, Fishy Marianne von den Driesch und Viktor Goebel wrote: Thanks for your help. We tried your code (using FOP 0.20.3) and got the message: TTURIResolver not found, is that your own class? MAVI. Am Freitag, 5. April 2002 12:36 schrieben Sie: what version of FOP do you use? try this code. it works perfectly with 0.20.3 FOP public static void execWFop(String xmlFile, String xslFile, String outputFile){ try{ try { javax.xml.transform.stream.StreamSource xmlSource=new javax.xml.transform.stream.StreamSource(new java.io.File(xmlFile)); javax.xml.transform.stream.StreamSource xslSource=new javax.xml.transform.stream.StreamSource(new java.io.File(xslFile)); javax.xml.transform.Transformer transformer=javax.xml.transform.TransformerFactory.newInstance() .newTransformer(xslSource); transformer.setURIResolver(new TTURIResolver()); org.apache.fop.apps.Driver driver=new org.apache.fop.apps.Driver(); driver.setOutputStream(new java.io.FileOutputStream(outputFile)); driver.setRenderer(org.apache.fop.apps.Driver.RENDER_PDF); transformer.transform(xmlSource, new javax.xml.transform.sax.SAXResult(driver.getContentHandler())); System.exit(2); } catch( Exception e ) { e.printStackTrace(System.out); } } BR, Fishy
svg from string
hi, i've got a java class with a method, what generates an svg object and returns it as string. i need fop to generate the svg into pdf, from the string. How? Thanks Fishy
Re: calling fop from java
that's ok, sorry but i didn't said, that i have an xml, and an xsl file, and i have to generate the pdf from them Fishy Alexandre Denes dos Santos wrote: Use: Driver driver = new Driver(InputStream in, OutputStream out); driver.setRenderer(Driver.RENDER_PDF); driver.run(); where in is the inputStream to the fo file that you will render and out is the outputstream where the pdf content will be write to. The package is org.apache.fop.apps. Hope that helps. Denes - Original Message - From: Fischer Tibor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 28, 2002 10:50 AM Subject: calling fop from java hi i would like to call the fop's transformation procedure from a running java application, to create pdf realtime how is it possible?? what method sholud i call?? Thanks, Fishy
Re: calling fop from java
and what i forgot again, i only get 3 existing filenames (xml, xsl, and output pdf) Fishy Fischer Tibor wrote: that's ok, sorry but i didn't said, that i have an xml, and an xsl file, and i have to generate the pdf from them Fishy Alexandre Denes dos Santos wrote: Use: Driver driver = new Driver(InputStream in, OutputStream out); driver.setRenderer(Driver.RENDER_PDF); driver.run(); where in is the inputStream to the fo file that you will render and out is the outputstream where the pdf content will be write to. The package is org.apache.fop.apps. Hope that helps. Denes - Original Message - From: Fischer Tibor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 28, 2002 10:50 AM Subject: calling fop from java hi i would like to call the fop's transformation procedure from a running java application, to create pdf realtime how is it possible?? what method sholud i call?? Thanks, Fishy
Re: AW: calling fop from java
Thanks for everybody's help Fishy S. Jayaraman wrote: Hi This is an extract from the site: http://xml.apache.org/fop/embedding.html Driver driver = new Driver(); driver.setRenderer(Driver.RENDER_PDF); InputHandler inputHandler = new XSLTInputHandler(xmlFile, xslFile); XMLReader parser = inputHandler.getParser(); driver.setOutputStream(new FileOutputStream(outFile)); driver.render(parser, inputHandler.getInputSource()); The above code should do it. Rgds Jay -Ursprüngliche Nachricht- Von: Fischer Tibor [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 28. Februar 2002 15:07 An: [EMAIL PROTECTED] Betreff: Re: calling fop from java that's ok, sorry but i didn't said, that i have an xml, and an xsl file, and i have to generate the pdf from them Fishy Alexandre Denes dos Santos wrote: Use: Driver driver = new Driver(InputStream in, OutputStream out); driver.setRenderer(Driver.RENDER_PDF); driver.run(); where in is the inputStream to the fo file that you will render and out is the outputstream where the pdf content will be write to. The package is org.apache.fop.apps. Hope that helps. Denes - Original Message - From: Fischer Tibor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 28, 2002 10:50 AM Subject: calling fop from java hi i would like to call the fop's transformation procedure from a running java application, to create pdf realtime how is it possible?? what method sholud i call?? Thanks, Fishy
Re: FOP0.20.3
i had the same bug with fop0.20.3, so i use fop0.20.1 instead, and that's ok Fishy Meena wrote: Hi, I tried using fop0.20.3. But while using the batch file, i'm getting the following error. What could be the reason? Exception in thread main java.lang.NoClassDefFoundError: org/apache/fop/apps/Fop regds Meena **Disclaimer Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited.
svg
hi, i would like to put svg file into the pdf, what i create from an xml file is it possible and if it is, how?? Thanks Fishy