Most servlet engines allows you to pass parameters to the VM when its starting. Find out how your servlet engine does this and pass:
-Djavax.xml.parsers.SAXParserFactory=qualified.name.of.parserfactory
JAXP looks in the following places when trying to locate a factory:
1) It uses the value of the system property (e.g. javax.xml.parsers.SAXParserFactory)2) It looks in the JRE/lib/jaxp.properties file
3) It uses a JAR file service provider to look in a file called META-INF/services/javax.xml.parsers.SAXParserFactory
4) It uses the default instance.
For a truly neutral configuration method, option 3 is your best bet. It is the method I use, and it works flawlessly.
As I make use of SAX, DOM and Transformers, I have three files in the META-INF/services directory:
javax.xml.parsers.SAXParserFactory
javax.xml.parsers.DocumentBuilderFactory
javax.xml.transform.TransformerFactory
each of these files contain a single line, specifying the appropriate implementation class to use.