JAXP Debug Log

By | July 16, 2013

Today I stumbled upon a Java system property that, when set to one, cause JAXP to output information about which factory implementations is used to instantiate different kinds of factories and where the information is found that these decisions are based upon. The system property is set like this:

In Eclipse, you add the above to the VM arguments of the appropriate launch configuration. In NetBeans, the system property can be added to the project VM Options in the Run category of the project’s properties.

I found the information about this system property in the documentation of the method newInstance of the class SAXParserFactory in the Java SE 7 API documentation.

If I add the above to a Mule project, I obtain the following console output when the project is run. The text in red is the JAXP log output:

The above log was generated when an instance Mule ESB is started up and reads one configuration file.

Note that:

  • Lines containing “find factoryId” tells us which factory is requested.
  • Lines containing “found jar resource” show that a resource specifying which factory type to use has been found in a JAR file.
    If the resource resides in META-INF/services then it has the filename indicated after the “META-INF/services/” part, for instance “javax.xml.stream.XMLInputFactory”.
  • The requested factory id and the filename of the file in META-INF/services are identical.
    Actually, the factory id is used to determine the filename to search for.
  • Lines containing “found in resource, value=” indicate the value of the resource discussed above.
    This is the name of the class that will be instantiated in request for the factory.

Leave a Reply

Your email address will not be published. Required fields are marked *