I'm trying to build a pdf from fo using fop. The document contains a reference to an svg image. Running fop yields this error: WARNING: Batik not in class path java.lang.NoClassDefFoundError: org/w3c/dom/svg/SVGDocument ... I have batik-1.7-12.fc16.noarch and fop-1.0-17.fc16.noarch installed.
I can reproduce this al follows: $ cat foo.fo <?xml version="1.0"?> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master master-name="foo"> <fo:region-body/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="foo"> <fo:flow flow-name="xsl-region-body"> <fo:block> <fo:external-graphic src="image.svg"/> </fo:block> </fo:flow> </fo:page-sequence> </fo:root> $ fop foo.fo foo.pdf May 25, 2012 7:40:45 PM org.apache.fop.image.loader.batik.PreloaderSVG$Loader getImage WARNING: Batik not in class path java.lang.NoClassDefFoundError: org/w3c/dom/svg/SVGDocument at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:634) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:277) at java.net.URLClassLoader.access$000(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:212) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at org.apache.batik.dom.svg.SVGDOMImplementation.createDocument(SVGDOMImplementation.java:149) at org.apache.batik.dom.util.SAXDocumentFactory.startElement(SAXDocumentFactory.java:615) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:504) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:793) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:376) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:602) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3080) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:899) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:819) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:748) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1208) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:525) at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:431) at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:349) at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(SAXSVGDocumentFactory.java:223) at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createSVGDocument(SAXSVGDocumentFactory.java:135) at org.apache.fop.image.loader.batik.PreloaderSVG$Loader.getImage(PreloaderSVG.java:122) at org.apache.fop.image.loader.batik.PreloaderSVG$Loader.access$100(PreloaderSVG.java:105) at org.apache.fop.image.loader.batik.PreloaderSVG.preloadImage(PreloaderSVG.java:73) at org.apache.xmlgraphics.image.loader.ImageManager.preloadImage(ImageManager.java:175) at org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:128) at org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:122) at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81) at org.apache.fop.fo.FObj.processNode(FObj.java:123) at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:282) at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:171) at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandler.java:208) at com.sun.org.apache.xml.internal.serializer.ToSAXHandler.flushPending(ToSAXHandler.java:281) at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:247) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:604) at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183) at com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.emptyElement(XIncludeHandler.java:981) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:353) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2732) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:819) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:748) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1208) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:525) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:640) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:711) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:317) at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:299) at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130) at org.apache.fop.cli.Main.startFOP(Main.java:174) at org.apache.fop.cli.Main.main(Main.java:204) Caused by: java.lang.ClassNotFoundException: org.w3c.dom.svg.SVGDocument at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) ... 64 more May 25, 2012 7:40:45 PM org.apache.fop.events.LoggingEventListener processEvent SEVERE: Image not available. URI: image.svg. Reason: org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported. No ImagePreloader found for image.svg (See position 11:47) This is a bug in fop, not batik. Reassigning.
Created attachment 587182 [details] Patch fixing the problem fop.script is missig xml-commons-apis-ext in classpath. The attached patch fixed the problem. (The patch targets rawhide though).
I can confirm that this patch fixes the svg issue in fop. Can someone please create an updated package for fop ? Thank you.
fop-1.0-20.fc17 has been submitted as an update for Fedora 17. https://admin.fedoraproject.org/updates/fop-1.0-20.fc17
fop-1.0-20.fc16 has been submitted as an update for Fedora 16. https://admin.fedoraproject.org/updates/fop-1.0-20.fc16
fop-1.0-20.fc18 has been submitted as an update for Fedora 18. https://admin.fedoraproject.org/updates/fop-1.0-20.fc18
Package fop-1.0-20.fc18: * should fix your issue, * was pushed to the Fedora 18 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing fop-1.0-20.fc18' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2012-18602/fop-1.0-20.fc18 then log in and leave karma (feedback).
fop-1.0-20.fc18 has been pushed to the Fedora 18 stable repository. If problems still persist, please make note of it in this bug report.
fop-1.0-20.fc16 has been pushed to the Fedora 16 stable repository. If problems still persist, please make note of it in this bug report.
fop-1.0-20.fc17 has been pushed to the Fedora 17 stable repository. If problems still persist, please make note of it in this bug report.