Provider Org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found problem troubleshooting

Source: Internet
Author: User

The custom ClassLoader starts the spring container and encounters
Provider Org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not subtype (Classpath under Class)
And
Provider Org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found (no class under Classpath)
Two exception information.

This problem is more strange, the lack of packages and no packages are problematic, there is a package of cases reported not subtype (this should be the problem between the ClassLoader, the direct adjustment of the class loading strategy for parents to assign policy, problem resolution), not the case reported not found. Can only go to the road of investigation.
First, according to the stack into the source code,

caused By:javax.xml.parsers.FactoryConfigurationError:Provider Org.apache.xerces.jaxp.DocumentBuilderFactoryImpl Not found
At Javax.xml.parsers.DocumentBuilderFactory.newInstance (Unknown Source)
At Com.ibatis.common.xml.NodeletParser.createDocument (nodeletparser.java:165)
At Com.ibatis.common.xml.NodeletParser.parse (nodeletparser.java:59)
At Com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse (sqlmapconfigparser.java:62)
At Com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse (sqlmapconfigparser.java:55)
At Org.springframework.orm.ibatis.SqlMapClientFactoryBean.buildSqlMapClient (sqlmapclientfactorybean.java:338)
At Org.springframework.orm.ibatis.SqlMapClientFactoryBean.afterPropertiesSet (sqlmapclientfactorybean.java:291)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods ( abstractautowirecapablebeanfactory.java:1648)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean ( abstractautowirecapablebeanfactory.java:1585)
... Common frames omitted

Parsing tools for XML have errors when instantiated, and it is strange that other modules that use the same framework do not have this problem. First open the parameters of the log output and add-djaxp.debug=true to the JVM's startup parameters

Once this parameter is open, you can output the specific implementation class that Documentbuilderfactory uses to instantiate it when it is instantiated.


Jaxp:find Factoryid =javax.xml.transform.transformerfactory
Jaxp:loaded from fallback Value:com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
Jaxp:created new instance of class Com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl using Classloader:null

Jaxp:find Factoryid =javax.xml.parsers.saxparserfactory
Jaxp:loaded from fallback Value:com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
Jaxp:created new instance of class Com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl using ClassLoader: Null

Under normal circumstances, your configuration class will be used first. You can configure which class to use in Systemproperty. If it is not configured, it will use the Com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl implementation class, which is the implementation class that comes with the jdk8.

The default fallback class is: Com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
Note This small piece of code, look for the fallback class under Classpath, if not found, use the default fallback class, this is automatically searched in the package, so as long as your package has the relevant implementation class, it will be loaded and instantiated.

Try Jar Service Provider mechanism
T Provider = Findserviceprovider (type);
if (provider! = NULL) {
return provider;
}

The problem is already very clear, in the Classpath directory to find out whether there are related classes, will be related to the dependency of the package can be excluded.

<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>

<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>

All let it use the default factory class. After elimination, the problem is resolved.

Provider Org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found problem troubleshooting

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.