StAX parser. To override the default SAX parser, the property in question is
In order to determine which factory is in use, the following options are searched in order:
1. Use the factory specified by the system property -Djavax.xml.stream.XMLIn-
2. Use the factory specified in the file called called jaxp.properties in the JAVA/jre/lib
directory. The factory is specified by a line like this:
3. Search the classpath for a file called META-INF/services/
javax.xml.stream.XMLInputFactory . The file should contain the single line
4. Use a JDK-defined default factory.
The third option can have a significant performance penalty, particularly in an environment
where there is a very lengthy classpath. To see if an alternate implementation has been speci-
fied, each entry in the classpath must be scanned for the appropriate file in the META-INF/
services directory. That search is repeated every time a factory is created, so if the classload-
er does not cache the lookup of that resource (and most classloaders do not), instantiating
factories will be very expensive.
It is much better to use one of the first two options to configure your application. The options
in the list work in order; once the factory is found, searching stops.
The downside of those first two options is that they apply globally to all code in the applica-
tion server. If two different EE applications are deployed to the same server and each re-
quires a different parser factory, the server must rely on the (potentially slow) classpath tech-
The way that the parser factory is found affects even the default factory: the JDK can't know
to use the default factory until it searches the classpath. Hence, even if you want to use the
default factory, you should configure the global system property or Java Runtime Environ-
ment (JRE) property file to point to the default implementation. Otherwise, the default fact-
ory (choice 4 in the list) won't be used until the expensive search in step 3 has been made.