SivaPhani
SivaPhani

Reputation: 81

Grails --- loader constraint violation

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)

Upvotes: 0

Views: 1158

Answers (1)

stefanglase
stefanglase

Reputation: 10402

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.

Upvotes: 2

Related Questions