10

Following up many many questions and answers to use BATIK, I'm having trouble of fixing my error and I couldn't find anything that might help. And this question has no answer.

My problem is when I download the pdf on my application, the error occur(I even tried to include the jar):

java.lang.ClassNotFoundException: org.apache.batik.dom.svg.SVGOMDocument

In my jasper report I have this included:

<image>
    <reportElement x="453" y="117" width="246" height="115"/>
        <imageExpression class="net.sf.jasperreports.engine.JRRenderable"><![CDATA[net.sf.jasperreports.renderers.BatikRenderer.getInstance(new java.io.File("C:\\Project\\myProject\\web-app\\images\\tomcat.svg"))]]>
        </imageExpression>
</image>

Basically, my BuildConfig.groovy is like this:

inherits("global") {
    excludes 'xml-apis', 'xml-apis-ext', 'xercesImpl'
}

and my dependencies:

compile("org.apache.xmlgraphics:fop:0.94",
        "org.apache.xmlgraphics:batik-transcoder:1.7",
        "org.apache.xmlgraphics:batik-codec:1.7",
        "org.apache.xmlgraphics:batik-awt-util:1.7",
        "org.apache.xmlgraphics:batik-bridge:1.7",
        "org.apache.xmlgraphics:batik-dom:1.7",
        "org.apache.xmlgraphics:batik-gvt:1.7",
        "org.apache.xmlgraphics:batik-svg-dom:1.7",
        "org.apache.xmlgraphics:batik-svggen:1.7",
        "org.apache.xmlgraphics:batik-util:1.7",
        "org.apache.xmlgraphics:batik-xml:1.7",
        "org.apache.xmlgraphics:batik-anim:1.7",
        "org.apache.xmlgraphics:batik-css:1.7",
        "org.apache.xmlgraphics:batik-ext:1.7",
        "org.apache.xmlgraphics:batik-js:1.7",
        "org.apache.xmlgraphics:batik-parser:1.7",
        "org.apache.xmlgraphics:batik-script:1.7",
        "org.apache.xmlgraphics:xmlgraphics-commons:1.2",
        "commons-logging:commons-logging:1.0.4",
        "org.apache.avalon.framework:avalon-framework-api:4.3.1",
        "org.apache.avalon.framework:avalon-framework-impl:4.3.1",
        "xalan:xalan:2.6.0",
        "xml-apis:xml-apis-ext:1.3.04"
){
transitive = false

Why I can't download? Invalid svg? I got this svg from wiki.

Community
  • 1
  • 1
fsi
  • 1,319
  • 1
  • 23
  • 51

2 Answers2

0

Check your deployed code on either the presence of batik-svg-dom-1.7.jar or batik-all-1.7.jar (using that would shorten your compile configuration considerably too). If it is missing, add it manually just to see if that fixes your issue. If it is missing however something is missing in your deploy configuration.

Norbert
  • 6,026
  • 3
  • 17
  • 40
0

This is not a good/bad answer nor a fix, but it only runs at grails run-war, I don't know why and it works.

fsi
  • 1,319
  • 1
  • 23
  • 51