Apache Batik - Common runtime exceptions list

In the last article, we described how to convert SVG to JPG using Batik As Batik involves quite a number of JAR files, you may get runtime exceptions if you are missing some JAR files in your classpath. In this post, we present a list of common exceptions that you can get with Batik, and how to fix them.

Exception-org/apache/batik/dom/util/DocumentFactory

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/batik/dom/util/DocumentFactory
        at svg2jpg.main(svg2jpg.java:14)
Caused by: java.lang.ClassNotFoundException: org.apache.batik.dom.util.DocumentFactory
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 1 more
You can fix this exception by adding batik-dom.jar file to your classpath.

Exception - org/apache/batik/bridge/BridgeContext

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/batik/bridge/BridgeContext
        at svg2jpg.main(svg2jpg.java:14)
Caused by: java.lang.ClassNotFoundException: org.apache.batik.bridge.BridgeContext
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 1 more
When you add batik-bridge.jar file to your classpath, this exception no longer appears.

Exception-org/apache/batik/css/engine/CSSContext

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/batik/css/engine/CSSContext
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at svg2jpg.main(svg2jpg.java:14)
Caused by: java.lang.ClassNotFoundException: org.apache.batik.css.engine.CSSContext
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 13 more
This gets addressed by adding batik-css.jar file to the classpath.

Exception - org/apache/batik/gvt/renderer/ImageRendererFactory

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/batik/gvt/renderer/ImageRendererFactory
        at svg2jpg.main(svg2jpg.java:14)
Caused by: java.lang.ClassNotFoundException: org.apache.batik.gvt.renderer.ImageRendererFactory
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 1 more
You can easily solve this by adding batik-gvt.jar to the classpath.

Exception - org/apache/batik/util/SVGFeatureStrings

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/batik/util/SVGFeatureStrings
        at org.apache.batik.bridge.UserAgentAdapter.addStdFeatures(UserAgentAdap
ter.java:68)
        at org.apache.batik.transcoder.SVGAbstractTranscoder$SVGAbstractTranscod
erUserAgent.<init>(SVGAbstractTranscoder.java:820)
        at org.apache.batik.transcoder.SVGAbstractTranscoder.createUserAgent(SVG
AbstractTranscoder.java:137)
        at org.apache.batik.transcoder.SVGAbstractTranscoder.<init>(SVGAbstractT
ranscoder.java:117)
        at org.apache.batik.transcoder.image.ImageTranscoder.<init>(ImageTransco
der.java:75)
        at org.apache.batik.transcoder.image.JPEGTranscoder.<init>(JPEGTranscode
r.java:45)
        at svg2jpg.main(svg2jpg.java:14)
Caused by: java.lang.ClassNotFoundException: org.apache.batik.util.SVGFeatureStrings
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 7 more
This is resolved by adding batik-util.jar to the classpath.

Exception - org/apache/batik/dom/svg/SVGDOMImplementation

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/batik/dom/svg/SVGDOMImplementation
        at org.apache.batik.transcoder.SVGAbstractTranscoder.<init>(SVGAbstractT
ranscoder.java:123)
        at org.apache.batik.transcoder.image.ImageTranscoder.<init>(ImageTransco
der.java:75)
        at org.apache.batik.transcoder.image.JPEGTranscoder.<init>(JPEGTranscode
r.java:45)
        at svg2jpg.main(svg2jpg.java:14)
Caused by: java.lang.ClassNotFoundException: org.apache.batik.dom.svg.SVGDOMImplementation
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 4 more
This is resolved by adding batik-svg-dom.jar to the classpath.

Exception - org/w3c/dom/svg/SVGDocument

Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/dom/svg/SVGDocument
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.apache.batik.transcoder.SVGAbstractTranscoder.createDocumentFactory(SVGAbstractTranscoder.java:150)
        at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:108)
        at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)
        at svg2jpg.main(svg2jpg.java:17)
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.svg.SVGDocument
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 16 more

This is fixed by adding xml-apis-ext.jar to the classpath.

Exception - org/w3c/dom/ElementTraversal

Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        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(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        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:200)
        at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(SAXSVGDocumentFactory.java:281)
        at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:129)
        at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)
        at svg2jpg.main(svg2jpg.java:17)
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 35 more

Fixed by adding batik-ext.jar to classpath.

Exception - org/apache/batik/xml/XMLUtilities

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/batik/xml/XMLUtilities
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.apache.batik.dom.svg.SVGDOMImplementation.createElementNS(SVGDOMImplementation.java:206)
        at org.apache.batik.dom.svg.SVGOMDocument.createElementNS(SVGOMDocument.java:372)
        at org.apache.batik.dom.svg.SVGDOMImplementation.createDocument(SVGDOMImplementation.java:152)
        at org.apache.batik.dom.util.SAXDocumentFactory.startElement(SAXDocumentFactory.java:615)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        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:200)
        at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(SAXSVGDocumentFactory.java:281)
        at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:129)
        at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)
        at svg2jpg.main(svg2jpg.java:17)
Caused by: java.lang.ClassNotFoundException: org.apache.batik.xml.XMLUtilities
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 37 more

Fixed by adding batik-xml.jar to classpath.

Exception - org/apache/batik/anim/values/AnimatableValue

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/batik/anim/values/AnimatableValue
        at org.apache.batik.dom.svg.SVGDOMImplementation$SvgElementFactory.create(SVGDOMImplementation.java:1459)
        at org.apache.batik.dom.svg.SVGDOMImplementation.createElementNS(SVGDOMImplementation.java:209)
        at org.apache.batik.dom.svg.SVGOMDocument.createElementNS(SVGOMDocument.java:372)
        at org.apache.batik.dom.svg.SVGDOMImplementation.createDocument(SVGDOMImplementation.java:152)
        at org.apache.batik.dom.util.SAXDocumentFactory.startElement(SAXDocumentFactory.java:615)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        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:200)
        at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(SAXSVGDocumentFactory.java:281)
        at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:129)
        at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)
        at svg2jpg.main(svg2jpg.java:17)
Caused by: java.lang.ClassNotFoundException: org.apache.batik.anim.values.AnimatableValue
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 26 more
Fixed by adding batik-anim.jar to classpath.

Exception - org/apache/batik/parser/UnitProcessor$Context


Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/batik/parser/UnitProcessor$Context
        at org.apache.batik.dom.svg.SVGDOMImplementation$SvgElementFactory.create(SVGDOMImplementation.java:1459)
        at org.apache.batik.dom.svg.SVGDOMImplementation.createElementNS(SVGDOMImplementation.java:209)
        at org.apache.batik.dom.svg.SVGOMDocument.createElementNS(SVGOMDocument.java:372)
        at org.apache.batik.dom.svg.SVGDOMImplementation.createDocument(SVGDOMImplementation.java:152)
        at org.apache.batik.dom.util.SAXDocumentFactory.startElement(SAXDocumentFactory.java:615)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        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:200)
        at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(SAXSVGDocumentFactory.java:281)
        at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:129)
        at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)
        at svg2jpg.main(svg2jpg.java:17)
Caused by: java.lang.ClassNotFoundException: org.apache.batik.parser.UnitProcessor$Context
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 26 more
Fixed by adding batik-parser.jar to the classpath.

Exception-org/apache/batik/script/InterpreterPool

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/batik/script/InterpreterPool
        at org.apache.batik.bridge.BridgeContext.<clinit>(BridgeContext.java:277)
        at org.apache.batik.transcoder.SVGAbstractTranscoder.createBridgeContext(SVGAbstractTranscoder.java:337)
        at org.apache.batik.transcoder.SVGAbstractTranscoder.createBridgeContext(SVGAbstractTranscoder.java:313)
        at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:194)
        at org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.java:92)
        at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:142)
        at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)
        at svg2jpg.main(svg2jpg.java:17)
Caused by: java.lang.ClassNotFoundException: org.apache.batik.script.InterpreterPool
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 8 more

Fixed by adding batik-script.jar to classpath.

Exception - org.apache.batik.transcoder.TranscoderException

Exception in thread "main" org.apache.batik.transcoder.TranscoderException: null

Enclosed Exception:
null
        at org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.java:132)
        at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:142)
        at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)
        at svg2jpg.main(svg2jpg.java:17)

Fixed by adding batik-codec.jar to class path.

3 comments:

  1. Really useful - saved a lot of time.

    Thanks
    Sean

    ReplyDelete
  2. May as well just paste them anyway:
    https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-transcoder
    https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-dom
    https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-bridge
    https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-css
    https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-util
    https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-svg-dom
    https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-anim
    https://mvnrepository.com/artifact/xml-apis/xml-apis-ext
    https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-ext
    https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-xml
    https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-parser
    https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-script
    https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-awt-util
    https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-gvt
    https://mvnrepository.com/artifact/org.apache.xmlgraphics/xmlgraphics-commons
    https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-bridge

    Hope this helps.
    Sean

    ReplyDelete