java.lang.ClassNotFoundException: org.apache.batik.dom.svg.SVGOMDocument
java.lang.ClassNotFoundException: org.apache.batik.dom.svg.SVGOMDocument
跟进许多关于使用 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?我从 wiki 获得了 this svg。
检查部署的代码是否存在 batik-svg-dom-1.7.jar 或 batik-all-1.7.jar(使用它会缩短编译时间配置也相当)。如果它丢失了,请手动添加它以查看是否可以解决您的问题。如果它丢失了,但是您的部署配置中缺少某些东西。
这不是 good/bad 答案也不是修复,但它只在 grails run-war
运行,我不知道为什么它有效。
跟进许多关于使用 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?我从 wiki 获得了 this svg。
检查部署的代码是否存在 batik-svg-dom-1.7.jar 或 batik-all-1.7.jar(使用它会缩短编译时间配置也相当)。如果它丢失了,请手动添加它以查看是否可以解决您的问题。如果它丢失了,但是您的部署配置中缺少某些东西。
这不是 good/bad 答案也不是修复,但它只在 grails run-war
运行,我不知道为什么它有效。