Hi Benson,

DocumentBuilderFactory and the other JAXP factories use the current
thread's context ClassLoader by default for locating the implementation. If
for whatever reason the implementation you wanted loaded isn't visible to
this ClassLoader you'll get a different implementation, most likely the
default one in the JDK. Couldn't tell you how this is occurring in your
environment. I've never used Tomcat or Maven.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrgla...@ca.ibm.com
E-mail: mrgla...@apache.org

Benson Margulies <bimargul...@gmail.com> wrote on 10/29/2009 12:35:42 PM:

> I have some code that uses DocumentBuilderFactory etc. (JAXP) to
> parse a document with W3C schema validation.
>
> My unit tests work fine with Xerces in the classpath.
>
> When the business is all packaged into a webapp and deployed in
> tomcat (via mvn tomcat:run), the validation fails with bogus error,
> and the backtrace shows that I'm using whatever nasty version of
> JAXP is sitting in the JVM. Short of calling
> DocumentBuilderFactoryImpl, can anyone tell me what I'm doing wrong?
> The xerces Jar is in the WAR file in the right place.

Reply via email to