grails fails to build war
Anyone has seen this issue before? What's the cause here?
Error executing script War: loader constraint violation in interface itable initialization: when resolving method "groovy.util.XmlParser.setDocumentLocator(Lorg/xml/sax/Locator;)V" the class loader (instance of org/codehaus/groovy/grails/cli/support/GrailsRootLoader) of the current class, groovy/util/XmlParser, and the class loader (instance of ) for interface org/xml/sax/ContentHandler have different Class objects for the type org/xml/sax/Locator used in the signature
at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at _GrailsWar_groovy$_run_closure4.class$(_GrailsWar_groovy) at _GrailsWar_groovy$_run_closure4.$get$$class$groovy$util$XmlParser(_GrailsWar_groovy) at _GrailsWar_groovy$_run_closure4.doCall(_GrailsWar_groovy:186) at War$_run_closure1.doCall(War.groovy:38) at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381) at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415) at gant.Gant$_dispatch_closure7.doCall(Gant.groovy) at gant.Gant.withBuildListeners(Gant.groovy:427) at
gant.Gant.this$2$withBuildListeners(Gant.groovy) at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source) at gant.Gant.dispatch(Gant.groovy:415) at gant.Gant.this$2$dispatch(Gant.groovy) at gant.Gant.invokeMethod(Gant.groovy) at gant.Gant.executeTargets(Gant.groovy:590) at gant.Gant.executeTargets(Gant.groovy:589)
开发者_开发百科EDIT: As answered by Tim and Peter below this issue is a typical xml-api lib getting in the way of classloader. After removing it from the ivy cache dir i was able to run the dependency-report and clearly see it being pulled in by hibernate->dom4j->xml-api . I ran the same report on another machine with the same code base and did not see this dependency being pulled in. So I am still trying to figure out what caused this issue in the first place. The quick fix for me was to add the following in the BuildConfig
inherits("global") {
excludes ( "xml-apis", "commons-digester")
}
Sounds like something has pulled the xml-apis
module into your classpath.
GroovyWS is sometimes the culprit. Have you added anything to the dependencies recently?
I assume the project used to work...so it must be something someone has added recently
Looking back through your source control might help you see what it is...
Or it could be something someone stuck in JAVA_HOME/lib/ext?
精彩评论