Grails hip tip: LinkageError with SAXParseException

how-to
Jun 10, 20101 min

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.

Looking to spin up Continuous Integration quickly? Check out www.ciinabox.com.
andrew_glover

When Andrew Glover isn't listening to “Funkytown” or “Le Freak” he enjoys speaking on the No Fluff Just Stuff Tour. He also writes articles for multiple online publications including IBM's developerWorks and O'Reilly’s ONJava and ONLamp portals. Andrew is also the co-author of Java Testing Patterns, which was published by Wiley in September 2004; Addison-Wesley’s Continuous Integration; and Manning’s Groovy in Action.

More from this author