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

标签 grails jasper-reports

跟踪了许多使用 BATIK 的问题和答案,我无法修复我的错误,并且找不到任何可能有帮助的内容。还有这个question没有答案。

我的问题是当我在应用程序上下载 pdf 时,发生错误(我什至尝试包含 jar):

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

在我的 jasper 报告中,我包含了以下内容:

<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>

基本上,我的 BuildConfig.groovy 是这样的:

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

和我的依赖项:

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

为什么我无法下载?无效的 svg?我得到了this来自 wiki 的 svg。

最佳答案

检查您部署的代码是否存在 batik-svg-dom-1.7.jar 或 batik-all-1.7.jar(使用它也会大大缩短您的编译配置)。如果缺少,请手动添加它,看看是否可以解决您的问题。如果缺少,但是您的部署配置中缺少某些内容。

关于grails - java.lang.ClassNotFoundException : org. apache.batik.dom.svg.SVGOMDocument,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30602684/

相关文章:

java - 如何在动态报告的 pdf 导出中写入 UTF-8(波斯语)字符?

java - Grails 消息 : No such property: for class: solutions:

grails - 无法在Grails/Groovy Web应用程序中执行Update()

jquery - grails,哪个 jquery 事件处理程序绑定(bind)到由 remoteFunction 或 remoteLink 进行的元素更新

jasper-reports - Jasperreports 和 iReport 升级兼容性

java - jasperreports 大型 Excel 文件

jasper-reports - iReport 表,每行重复附加记录

grails - 如何在 Grails 中保存或更新?

grails - 检测请求是否是来自另一个 Controller 操作的 "forward()"的正确方法是什么?

jasper-reports - Print When Expression 仅打印组中的最后一个元素