Bug #5306
closedSaxon 11.1 breaks my code (SAXParserFactory.newInstance() problem is back)
0%
Description
In Configuration.init() a CatalogResourceResolver is created:
commonResolver = new CatalogResourceResolver();
This leads to
SAXParserFactory.newIntance()
in org.xmlresolver.cache.ResourceCache, which looks at the global system property
"javax.xml.parsers.SAXParserFactory".
I have to use the global property for other parts in my source code (set to org.apache.xerces.jaxp.SAXParserFactoryImpl), and up to now Saxon was neglecting the property.
I thought JAXP and global properties are considered "evil"?
Any ideas how I can solve the problem?
Here is the stack:
InvocationTargetException Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found java.xml/javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:195) java.xml/javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:147) java.xml/javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:227) java.xml/javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:181) org.xmlresolver.cache.ResourceCache.(ResourceCache.java:189) org.xmlresolver.XMLResolverConfiguration.getFeature(XMLResolverConfiguration.java:971) org.xmlresolver.CatalogResolver.(CatalogResolver.java:51) org.xmlresolver.Resolver.(Resolver.java:63) net.sf.saxon.lib.CatalogResourceResolver.(CatalogResourceResolver.java:46) net.sf.saxon.Configuration.init(Configuration.java:366) net.sf.saxon.Configuration.(Configuration.java:229) java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
Related issues
Updated by Michael Kay almost 3 years ago
- Category set to Internals
- Assignee set to Norm Tovey-Walsh
- Applies to branch 11, trunk added
Sounds as if it would be a good idea if the CatalogResolver supplied an alternative way to instantiate an XML parser, as an alternative to the JAXP mechanism.
You can always set your own Configuration-level ResourceResolver that does nothing (always returns null) but I don't know if that would have unwanted side-effects.
Updated by Michael Kay almost 3 years ago
Note there is a relationship to bug #5096, which is a failure to do dynamic loading of the SAX parser from the old catalog resolver in Saxon/.NET 10.6; which could also be solved by allowing the user to supply an XMLReader directly, rather than relying on the JAXP mechanism to get one.
Updated by Michael Kay almost 3 years ago
- Related to Bug #5096: .NET: FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found added
Updated by Norm Tovey-Walsh almost 3 years ago
Fix applied to XML Resolver: https://github.com/xmlresolver/xmlresolver/pull/92
Updated by Norm Tovey-Walsh almost 3 years ago
- Status changed from New to Resolved
Updated by Norm Tovey-Walsh almost 3 years ago
- Status changed from Resolved to Closed
- Fixed in Maintenance Release 11.2 added
Please register to edit this issue