蜡染与萨克斯碰撞的grails [英] Batik with grails giving sax clash

查看:110
本文介绍了蜡染与萨克斯碰撞的grails的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在IntelliJ中添加下面的错误,当我添加的时候,我在添加一些SVG东西到服务器上的PNG。对BuildConfig的依赖,然后告诉IntelliJ加载更改:

$ p $ /Library/Java/JavaVirtualMachines/1.6.0_33-b03- 424.jdk / Contents / Home / bin / java -Dgrails.home = / Applications / Dev / grails-2.1.0 -Dbase.dir = / Users / greg / Documents / development / git / liftyourgame-grails / webapp -Dtools。 jar = / Library / Java / JavaVirtualMachines / 1.6.0_33-b03-424.jdk / Contents / Home / lib / tools.jar -Dgroovy.starter.conf = / Applications / Dev / grails-2.1.0 / conf / groovy- starter.conf -Xmx512M -XX:MaxPermSize = 192m -javaagent:/ Applications / IntelliJ IDEA 11.app/plugins/Grails/lib/grails_rt.jar -Dprint.grails.settings = true -Dfile.encoding = UTF-8 -classpath /Applications/Dev/grails-2.1.0/lib/org.codehaus.groovy/groovy-all/jars/groovy-all-1.8.6.jar:/Applications/Dev/grails-2.1.0/dist/grails- bootstrap-2.1.0.jar org.codehaus.groovy.grails.cli.suppo rt.GrailsS​​tarter --main org.codehaus.groovy.grails.cli.GrailsS​​criptRunner --conf /Applications/Dev/grails-2.1.0/conf/groovy-starter.conf help

|加载Grails 2.1.0
|配置classpath
|错误错误执行脚本帮助:加载程序约束违规:何时解析重写方法org.apache.tools.ant.helper.ProjectHelper2 $ RootHandler.setDocumentLocator(Lorg / xml / sax / Locator;)V类加载器(org / org / apache / tools / ant / helper / ProjectHelper2 $ RootHandler及其超类加载器(< bootloader>的实例),具有不同的Class对象在签名中使用org / xml / sax / Locator(使用--stacktrace查看完整跟踪)

IDEA hook:找不到Grails!
|错误java.lang.NullPointerException
| org.jetbrains.groovy.grails.rt.Agent出错$ 2.run(Agent.java:88)
| Error java.lang.Thread.run(Thread.java:680)

Grails clean给出了类似的结果结果。

BuildConfig.groovy包含其他内容:

  grails .project.dependency.resolution = {
//继承Grails的默认依赖关系
inherits(global){
不包括'slf4j-log4j12','xml-apis','xalan' ,'xml-apis-ext','commons-logging','commons-io'
}
logwarn//常春藤解析器的日志级别,'error','warn', 'info','debug'或'verbose'
checksums true //是否验证解析的校验和
$ b存储库{
inherits true //是否从插件继承存储库定义
grailsPlugins()
grailsHome()
grailsCentral()
mavenCentral()
}
依赖关系{
compileorg.jadira.usertype :usertype.jodatime:1.9
编译org.imgscalr:imgscalr-lib:4.0
compile(org.apache.xmlgraphics:batik-svg-dom:1.7)
{
不包括'batik-xml', 'batik-dom','commons-javaflow',
'avalon-framework-api','avalon-framwork-impl',
'蜡染css','蜡染gvt','蜡染-script',
'slf4j-log4j12','xml-apis','xml-apis-ext','log4j','xercesImpl','xalan',
'antlr','commons -beanutils','commons-collections','commons-logging','xmlParserAPIs',
'ant','mondrian','groovy-all','saaj-api','servlet-api', 'spring-core','bsh',
'spring-beans','jaxen','persistence-api','jdtcore','bcmail-jdk16','bcprov-jdk16',
'bctsp-jdk16','bcmail-jdk14 ,'bcprov-jdk14','bctsp-jdk14','xmlbeans'
}

}

batik-svg-dom的pom包括一些其他蜡染瓶以及xml-apis和xml-apis-ext。我的研究表明,xml依赖可能会在grails下引起麻烦,因为它们在jdk 1.4之外并不需要,所以它们被排除在外。



我也试图追踪其他使用IntelliJs工具的org.xml.sax.Locator实例,但唯一找到的实例位于:/Applications/Dev/grails-2.1.0/lib/org.apache.ant/ant-launcher/jars/ant-launcher-1.8 .2.jar!/org/apache/tools/ant/launch/Locator.class



我也尝试过grails刷新依赖项,我尝试删除.grails文件夹,但我总是得到相同的结果。



有什么想法吗?

解决方案

这个问题似乎是Batik包含了一个与现在包含在JDK中的版本冲突的xml-apis版本。 ( http://grails.1312388。 n4.nabble.com/Problems-integrating-batik-with-grails-project-td4632728.html )所以,这是一个排除'xml-apis'的问题,因为你已经完成了。然而,由于很多蜡染的罐子对xml-apis有传递依赖性,所以很难让Grails排除它。这是最终对我的工作:

$ $ p $ 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
}

这基本上是我想包括的蜡染罐的白名单。由于transitive = false,传递依赖被忽略。



然而,我仍然无法真正让Batik工作 - 这似乎是org.apache的第二个问题。 batik.dom.svg.SVGOMDocument即使在我的战争中部署了所需的包含该类的JAR也没有。



您是否找到另一种工作解决方案?


I'm trying to use batik with grails to render some SVG stuff to PNG on the server.

I'm getting the following error in IntelliJ when I add the dependencies to BuildConfig and then tell IntelliJ to load the changes:

/Library/Java/JavaVirtualMachines/1.6.0_33-b03-424.jdk/Contents/Home/bin/java -Dgrails.home=/Applications/Dev/grails-2.1.0 -Dbase.dir=/Users/greg/Documents/development/git/liftyourgame-grails/webapp -Dtools.jar=/Library/Java/JavaVirtualMachines/1.6.0_33-b03-424.jdk/Contents/Home/lib/tools.jar -Dgroovy.starter.conf=/Applications/Dev/grails-2.1.0/conf/groovy-starter.conf -Xmx512M -XX:MaxPermSize=192m -javaagent:/Applications/IntelliJ IDEA 11.app/plugins/Grails/lib/grails_rt.jar -Dprint.grails.settings=true -Dfile.encoding=UTF-8 -classpath /Applications/Dev/grails-2.1.0/lib/org.codehaus.groovy/groovy-all/jars/groovy-all-1.8.6.jar:/Applications/Dev/grails-2.1.0/dist/grails-bootstrap-2.1.0.jar org.codehaus.groovy.grails.cli.support.GrailsStarter --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf /Applications/Dev/grails-2.1.0/conf/groovy-starter.conf help

| Loading Grails 2.1.0
| Configuring classpath
| Error Error executing script Help: loader constraint violation: when resolving overridden method "org.apache.tools.ant.helper.ProjectHelper2$RootHandler.setDocumentLocator(Lorg/xml/sax/Locator;)V" the class loader (instance of org/codehaus/groovy/grails/cli/support/GrailsRootLoader) of the current class, org/apache/tools/ant/helper/ProjectHelper2$RootHandler, and its superclass loader (instance of <bootloader>), have different Class objects for the type org/xml/sax/Locator used in the signature (Use --stacktrace to see the full trace)

IDEA hook: Grails not found!
| Error java.lang.NullPointerException
| Error     at org.jetbrains.groovy.grails.rt.Agent$2.run(Agent.java:88)
| Error     at java.lang.Thread.run(Thread.java:680)

Grails clean gives a similar result.

BuildConfig.groovy contains among other things:

grails.project.dependency.resolution = {
    // inherit Grails' default dependencies
    inherits("global") {
        excludes 'slf4j-log4j12', 'xml-apis', 'xalan', 'xml-apis-ext', 'commons-logging', 'commons-io'
    }
    log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
    checksums true // Whether to verify checksums on resolve

    repositories {
        inherits true // Whether to inherit repository definitions from plugins
        grailsPlugins()
        grailsHome()
        grailsCentral()
        mavenCentral()
    }
    dependencies {
        compile "org.jadira.usertype:usertype.jodatime:1.9"
        compile "org.imgscalr:imgscalr-lib:4.0"
        compile("org.apache.xmlgraphics:batik-svg-dom:1.7")
            {
                excludes 'batik-xml', 'batik-dom', 'commons-javaflow',
                        'avalon-framework-api', 'avalon-framwork-impl',
                        'batik-css', 'batik-gvt', 'batik-script',
                        'slf4j-log4j12', 'xml-apis', 'xml-apis-ext', 'log4j', 'xercesImpl', 'xalan',
                        'antlr', 'commons-beanutils', 'commons-collections', 'commons-logging', 'xmlParserAPIs',
                        'ant', 'mondrian', 'groovy-all', 'saaj-api', 'servlet-api', 'spring-core', 'bsh',
                        'spring-beans', 'jaxen', 'persistence-api', 'jdtcore', 'bcmail-jdk16', 'bcprov-jdk16',
                        'bctsp-jdk16', 'bcmail-jdk14', 'bcprov-jdk14', 'bctsp-jdk14', 'xmlbeans'
            }

}

The pom for batik-svg-dom includes some of the other batik jars as well as xml-apis and xml-apis-ext. My research has shown that the xml dependencies can cause trouble under grails and as they are not required beyond jdk 1.4 they have been excluded.

I've also tried to track down other org.xml.sax.Locator instances using IntelliJs tools but the only instance found is in: /Applications/Dev/grails-2.1.0/lib/org.apache.ant/ant-launcher/jars/ant-launcher-1.8.2.jar!/org/apache/tools/ant/launch/Locator.class

I've also tried grails refresh-dependencies and I've tried removing the .grails folder but I always get the same result.

Any ideas please?

解决方案

The issue seems to be that Batik includes a version of xml-apis that clashes with the one now included in the JDK. (http://grails.1312388.n4.nabble.com/Problems-integrating-batik-with-grails-project-td4632728.html) So, it's a matter of excluding 'xml-apis' as you have done already. However, since so many of Batik's jars have transitive dependencies on xml-apis, it is hard to get Grails to exclude it. Here's what eventually worked for me:

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
    }

This is basically a whitelist of the Batik jars I want to include. Since transitive = false, transitive dependencies are ignored.

However, I still can't actually get Batik to work - there seems to be a secondary issue where org.apache.batik.dom.svg.SVGOMDocument is missing even though the required jars which contain that class are deployed in my war.

Did you find another working solution?

这篇关于蜡染与萨克斯碰撞的grails的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆