Thursday, June 26, 2008

Spring - Xerces classpath clash!

If you have problems with your Spring application and you get such error message:


org.springframework.beans.factory.BeanDefinitionStoreException: Parser configuration exception parsing XML from file [...\applicationContext.xml]; nested exception is javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.xerces.jaxp.DocumentBuilderFactoryImpl@6d0040] does not support XML Schema. Are you running on Java 1.4 with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.


you have a big problem ;) In my project the problematic dependency is commons-jxpath that includes xerces-1.2.3. If you use Maven 2 solution is quite simple:

<dependency>
<groupId>commons-jxpath</groupId>
<artifactId>commons-jxpath</artifactId>
<version>1.2</version>
<exclusions>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xerces</artifactId>
</exclusion>
</exclusions>
</dependency>

But it could cause real problems in runtime - test your stuff properly before committing such exclusion because someone else could depend on Xerces in this version. If that's the case I don't know how to solve it right now.

2 comments:

Anonymous said...

Thanks!

Anonymous said...

You are a LIFE SAVER. Thank youuuuuu