Re: ClassCast-Exception when trying fopfactory.newinstance()
That usually indicates an encoding problem in the XML. For example, you specify UTF-8 as the encoding but use a non-XML-aware text editor in a ISO-8859-1 fashion. On 08.04.2008 12:42:36 Andreas Schröder wrote: I got two times the same library in different places of my tomcat. I removed one and the exception doesn't occur anymore. but a new error occured. In the output on the console of the conversion process appears: (position of error unknown)java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence. The funny thing is still, that it worked before. ;-) -Ursprüngliche Nachricht- Von: fop-users@xmlgraphics.apache.org Gesendet: 08.04.08 12:30:51 An: fop-users@xmlgraphics.apache.org Betreff: Re: ClassCast-Exception when trying fopfactory.newinstance() Works for me. The ClassCastException doesn't make much sense as the AFPExtensionHandlerFactory IS an implementation of the ContentHandlerFactory interface. So I realy don't understand why this happens. The only reason I can think of is that there's is a mix of different, incompatible versions of fop.jar in the classpath. But I'm not sure how this can happen as both the interface and the implementation are in the same JAR file. So I'd check if your application classpath is clean. HTH Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCast-Exception when trying fopfactory.newinstance()
I got two times the same library in different places of my tomcat. I removed one and the exception doesn't occur anymore. but a new error occured. In the output on the console of the conversion process appears: (position of error unknown)java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence. The funny thing is still, that it worked before. ;-) -Ursprüngliche Nachricht- Von: fop-users@xmlgraphics.apache.org Gesendet: 08.04.08 12:30:51 An: fop-users@xmlgraphics.apache.org Betreff: Re: ClassCast-Exception when trying fopfactory.newinstance() Works for me. The ClassCastException doesn't make much sense as the AFPExtensionHandlerFactory IS an implementation of the ContentHandlerFactory interface. So I realy don't understand why this happens. The only reason I can think of is that there's is a mix of different, incompatible versions of fop.jar in the classpath. But I'm not sure how this can happen as both the interface and the implementation are in the same JAR file. So I'd check if your application classpath is clean. HTH _ Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! http://smartsurfer.web.de/?mc=100071distributionid=0066 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCast-Exception when trying fopfactory.newinstance()
I only use Word2003 and save the file as an xml. The xml-file-encoding ist UTF-8. -Ursprüngliche Nachricht- Von: fop-users@xmlgraphics.apache.org Gesendet: 08.04.08 12:55:50 An: fop-users@xmlgraphics.apache.org Betreff: Re: ClassCast-Exception when trying fopfactory.newinstance() That usually indicates an encoding problem in the XML. For example, you specify UTF-8 as the encoding but use a non-XML-aware text editor in a ISO-8859-1 fashion. _ In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCast-Exception when trying fopfactory.newinstance()
Are you sure it's the XML file it's complaining about and not the stylesheet maybe? Have you opened the XML file in an XML editor to check the wellformedness? On 08.04.2008 13:08:43 Andreas Schröder wrote: I only use Word2003 and save the file as an xml. The xml-file-encoding ist UTF-8. -Ursprüngliche Nachricht- Von: fop-users@xmlgraphics.apache.org Gesendet: 08.04.08 12:55:50 An: fop-users@xmlgraphics.apache.org Betreff: Re: ClassCast-Exception when trying fopfactory.newinstance() That usually indicates an encoding problem in the XML. For example, you specify UTF-8 as the encoding but use a non-XML-aware text editor in a ISO-8859-1 fashion. Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCast-Exception when trying fopfactory.newinstance()
The stylesheet is from microsoft especially for transforming word-xml and the xml is well-formed. It already worked fine before, I also recreated the xml-file to ensure it's not corrupted. -Ursprüngliche Nachricht- Von: fop-users@xmlgraphics.apache.org Gesendet: 08.04.08 13:13:55 An: fop-users@xmlgraphics.apache.org Betreff: Re: ClassCast-Exception when trying fopfactory.newinstance() Are you sure it's the XML file it's complaining about and not the stylesheet maybe? Have you opened the XML file in an XML editor to check the wellformedness? On 08.04.2008 13:08:43 Andreas Schröder wrote: I only use Word2003 and save the file as an xml. The xml-file-encoding ist UTF-8. -Ursprüngliche Nachricht- Von: fop-users@xmlgraphics.apache.org Gesendet: 08.04.08 12:55:50 An: fop-users@xmlgraphics.apache.org Betreff: Re: ClassCast-Exception when trying fopfactory.newinstance() That usually indicates an encoding problem in the XML. For example, you specify UTF-8 as the encoding but use a non-XML-aware text editor in a ISO-8859-1 fashion. Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Unbegrenzter Speicherplatz für Ihr E-Mail Postfach? Jetzt aktivieren! http://freemail.web.de/club/landingpage.htm/?mc=02 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ClassCast-Exception when trying fopfactory.newinstance()
I get a ClassCastException if I try to make an instance with FopFactory.newInstance(). It already used to work but now doesn't any more while I made no changes to the class. I type an excerpt from the StackTrace: cce: org.apache.fop.render.afp.extensions.AFPExtensionHandlerFactory cannot be cast to org.apache.fop.util.ContentHandlerFactoryRegistry.java:105) at ... at org.apache.fop.apps.FopFactory.newInstance(FopFactory.java:165) at de.hc.pdf_from_word.PdfCreator.convertXML2PDF(PdfCreator.java:44) That points exactly to my file, where i create the new instance of FopFactory. I give you the code of the method, I use: public void convertXML2PDF(File xml, File xslt, File pdf) throws IOException, TransformerException { System.out.println(xml); System.out.println(xslt); System.out.println(pdf); try { FopFactory fopFactory = FopFactory.newInstance(); //Setup output out = new FileOutputStream(pdf); out = new BufferedOutputStream(out); try { Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out); //Setup XSLT TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(new StreamSource(xslt)); //Setup input for XSLT transformation Source src = new StreamSource(xml); //Resulting SAX events (the generated FO) must be piped through to FOP Result res = new SAXResult(fop.getDefaultHandler()); //Start XSLT transformation and FOP processing transformer.transform(src, res); } catch (Exception e) { e.printStackTrace(System.err); } finally { out.close(); } } catch (Throwable e) { // TODO Auto-generated catch block e.printStackTrace(System.err); //e.getCause().printStackTrace(System.err); } } _ Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! http://smartsurfer.web.de/?mc=100071distributionid=0066 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCast-Exception when trying fopfactory.newinstance()
Jeremias Maerki wrote: Works for me. The ClassCastException doesn't make much sense as the AFPExtensionHandlerFactory IS an implementation of the ContentHandlerFactory interface. So I realy don't understand why this happens. The only reason I can think of is that there's is a mix of different, incompatible versions of fop.jar in the classpath. In a web application, this may also be happen if the AFPExtensionHandlerFactory has been loaded in a different security context , which means it is an implementation of the ContentHandlerFactory of the other context. Still, the primary cause is that there are two FOP jars (and a cross servlet call). J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]