Gary
Gary

Reputation: 163

org.apache.xerces.jaxp.DocumentBuilderFactoryImpl incompatible with javax.xml.parsers.DocumentBuilderFactory

I encounter below issues when i tried to start my application in WAS8.0.

[

12/5/13 16:01:53:633 GMT] 00000010 ContextLoader I org.springframework.web.context.ContextLoader initWebApplicationContext Root WebApplicationContext: initialization started
[12/5/13 16:01:53:736 GMT] 00000010 XmlWebApplica I org.springframework.context.support.AbstractApplicationContext prepareRefresh Refreshing Root WebApplicationContext: startup date [Thu Dec 05 16:01:53 GMT 2013]; root of context hierarchy
[12/5/13 16:01:53:821 GMT] 00000010 XmlBeanDefini I org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions Loading XML bean definitions from class path resource [XXX.xml]
[12/5/13 16:01:53:858 GMT] 00000010 ContextLoader E org.springframework.web.context.ContextLoader initWebApplicationContext Context initialization failed
                                 org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [XXX.xml]; nested exception is java.lang.ClassCastException: <b>org.apache.xerces.jaxp.DocumentBuilderFactoryImpl incompatible with javax.xml.parsers.DocumentBuilderFactory</b>
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)

Upvotes: 2

Views: 8827

Answers (1)

Vidya
Vidya

Reputation: 30320

Make sure you bring the latest version of Xerces into the classpath. DocumentBuilderFactoryImpl implements javax.xml.parsers.DocumentBuilderFactory as shown here.

And as @Augusto says, make sure you don't have multiple versions of Xerces either.

Upvotes: 1

Related Questions