I am not able to get past this problem. Browsed through many forums. Pls help:
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is javax.xml.parsers.FactoryConfigurationError: Provider for javax.xml.parsers.DocumentBuilderFactory cannot be found.
I have included all the jar files in xerces bin. Following is my WEB-INF/lib structure:
public abstract class DocumentBuilderFactory extends Object. Defines a factory API that enables applications to obtain a parser that produces DOM object trees from XML documents.
public abstract class SAXParserFactory extends Object. Defines a factory API that enables applications to configure and obtain a SAX based parser to parse XML documents.
We have this problem also when upgrade spring and jpa/hibernate from 3 to 4. For us it is because hibernate-entitymanager 4.3.11 has a dependency on jdom which has a dependency on xml-apis which will conflict with the JRE’s rt.jar’s javax.xml stuff. We exclude it so that our spring xml config could be correctly parsed. To solve the problem, we can just exclude the xml-apis from the dependency tree.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
I also had this problem working with WebSphere Portal 8. I was recently using xalan 2.7.0 for accessing and parsing XML.
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.0</version>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
After removing the xml-apis (like Leon Li did) it worked fine.
I could resolve the above problem entirely, by setting the order in which classloader should load the xerces jar files (WAR->EAR->Server). The following link is taken from Xerces site at Apache. It helps to resolve the above issue for Websphere Portal/WAS:
http://www.ibm.com/developerworks/websphere/library/techarticles/0310_searle/searle.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With