Grails hip tip: LinkageError with SAXParseException

Recently a bogue error popped up with an existing Grails project at a client site. In an effort to abstract core domain logic (i.e. business rules) for a financial application, we decided to leverage Drools; consequently, after some prototyping of rules in a non-Grails project, we decided to start evaluating the Grails Drools plugin.

After installing said plugin, however, Grails failed to start up, instead issuing the error:

java.lang.LinkageError: loader constraint violation: loader (instance of ) previously initiated loading for a different type with name “org/xml/sax/SAXParseException”

followed by an equally nefarious stack trace.

It turns out that differing versions of the xml-apis jar will force this issue; accordingly, if this happens to you, you can fix the situation by simply locating the offending jar file (in this case, it was the Drools plugin which includes a differing version: xml-apis-1.0.b2.jar) and removing it.

Post to Twitter

Related odds and ends
 
You can leave a response, or trackback from your own site.

3 Responses to “Grails hip tip: LinkageError with SAXParseException”

  1. [...] This post was mentioned on Twitter by thediscoblog, groovyblogs.org. groovyblogs.org said: Grails hip tip: LinkageError with SAXParseException — http://bit.ly/9eGMIp — The Disco Blog [...]

  2. Desall says:

    It’s my impression that I don’t want any version of xml-apis to come along transitively with a dependency. It has invariably always failed Grails to boot.
    Most Grails core dependencies I know of also exclude xml-apis from exclusion and I’m pretty sure they are not needed.

    A similar problem occurs with the maven-publisher plugin bringing in a very old version of commons-http while the functional-test plugin requires a newer one.

  3. esword says:

    I had much the same experience with PdfBox and GeoTools a couple of months ago. I blogged about it here:
    http://swordsystems.com/2010/03/20/grailsmavengeotoolspdfbox-pita/

Leave a Reply