Grails — loader constraint violation

China☆狼群 提交于 2019-12-12 05:42:15

问题


In one of my application i have to use geb with grails. i installed geb plugin and added dependency selenium standalone jar.

Now the problem is while i cleaning or compiling i got the error like following

Interactive mode exited with error: loader constraint violation: when resolving overridden method "org.apache.xerces.jaxp.SAXParserImpl.getXMLReader()Lorg/xml/sax/XMLReader;" the class loader (instance of org/codehaus/groovy/grails/cli/support/GrailsRootLoader) of the current class, org/apache/xerces/jaxp/SAXParserImpl, and its superclass loader (instance of <bootloader>), have different Class objects for the type org/xml/sax/XMLReader used in the signature (Use --stacktrace to see the full trace)


回答1:


Exclude the transitive dependency of Selenium to xml-apis like this in your BuildConfig.groovy:

dependencies {
    test("org.seleniumhq.selenium:selenium-htmlunit-driver:$seleniumVersion") {
        exclude "xml-apis"
    }
    test "org.codehaus.geb:geb-spock:$gebVersion"
    test "org.codehaus.geb:geb-junit4:$gebVersion"
}

See this example project for more details.



来源:https://stackoverflow.com/questions/12618704/grails-loader-constraint-violation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!