I have the following code:
javax.xml.transform.TransformerFactory factory = TransformerFactory.newInstance();
factory.setAttribute(XMLConstants.ACCESS_EXTERN
I was facing a similar issue where an implementation from SaxonJ was being created in TransformerFactory::newInstance, giving me errors when trying to set attributes not supported by it.
Taking a look at the method documentation, I found out that TransformerFactory has a priority list where it tries to find an implementation to return.
The first place it looks for is in the system properties, so in my Ant file, inside my run target, I added the following(other libraries will have the same):
This will make TransformerFactory::newInstance load the correct factory implementation.
Keep in mind that I was using OpenJDK8, you will have to find the correct package for other versions.