In my current project, we target a JDK 1.6 Runtime environment. For legacy rasons, Xerces JAR files are bundled in the application.
These are no longer needed right? The JDK has (for a while) had XML parsing libraries bundled in the JDK?
These XML services plug in application environment using so-called "service provider" mechanism.
It works as follows:
-Djavax.xml.parsers.SAXParserFactory=<some class>
.FactoryFinder
looks for property in special properties file. For example ${java.home}/lib/jaxp.properties
.META-INF/services/<some service>
, e.g. META-INF/services/javax.xml.parsers.SAXParserFactory
.
It is a file that should contain factory class name for example org.apache.xerces.jaxp.SAXParserFactoryImpl
.So if you do not have system property pointing to evident factory class java will choose suitable implementation quietly.