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=100071&distributionid=000000000066
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]