How to make Tomcat use the Xerces XML parser instead of the Sun JAXP XML parser?

Alex Chaffee

You can do one of two things:

  1. Replace the Tomcat system files jaxp.jar and parser.jar (located in TOMCAT_HOME/lib) -- that is, delete them and install the Xerces jars in their place
  2. Include your preferred XML parser jars (xerces.jar and/or xalan.jar) inside your web application's WEB-INF/lib
The second method is preferred, since then you can run other web applications -- and Tomcat itself -- without worrying that they're incompatible with Xalan/Xerces (or whatever your favorite XML parser is). However, it has been known to fail, since Classloader munging is something of a black art and hasn't always been implemented correctly in Tomcat (or Java).

So try #2 first, then if that fails, try #1.