Gotcha: JUnit tests fail on Eclipse with a mysterious Xerces error

I had a strange problem occurring with some JUnit tests

java.lang.AbstractMethodError: org.apache.xerces.dom.DeferredElementImpl.getTextContent()Ljava/lang/String;
at com.whirlycott.cache.CacheManager.configure(Unknown Source)
at com.whirlycott.cache.CacheManager.(Unknown Source)
at com.whirlycott.cache.CacheManager.(Unknown Source)

Turns out that if you have Commons Configuration specified in your Maven POM, you’ll get this error. You need to specify this in pom.xml:

 
<dependency>
<groupid>commons-configuration</groupid>
<artifactid>commons-configuration</artifactid>
<version>1.1</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupid>xerces</groupid>
<artifactid>xerces</artifactid>
</exclusion>
</exclusions>
</dependency> <strong style="display:none"><a href="http://www.cccmz.de/wp-content/uploads/2006/08/breast-augmentation-gummy-bear-implants.html">augmentation implants breast gummy bear</a></strong>

… and specify xercesImpl 2.6.2 as a dependency. Things will work again.