我正在尝试使用带有 grails 的 batik 在服务器上将一些 SVG 内容渲染为 PNG。
当我将依赖项添加到 BuildConfig 然后告诉 IntelliJ 加载更改时,我在 IntelliJ 中收到以下错误:
/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 给出了类似的结果。
BuildConfig.groovy 包含以下内容:
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'
}
}
batik-svg-dom 的 pom 包括其他一些 batik jar 以及 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 refresh-dependencies 并尝试删除 .grails 文件夹,但我总是得到相同的结果。
请问有什么想法吗?