title: Class for namespace [http://www.springframework.org/schema/batch] not implement [org.springframework.beans.factory.xml.NamespaceHandler] interface
body: <p>I am getting the following error when I startup Spring web application in Tomcat.</p>
  
  <p>Basically, as the beans.xml file is processed, the following classes are loaded in order. </p>
  
  <p>org.springframework.context.config.ContextNamespaceHandler to process URI   <a href="http://www.springframework.org/schema/context" rel="nofollow noreferrer">http://www.springframework.org/schema/context</a></p>
  
  <p>org.springframework.beans.factory.xml.UtilNamespaceHandler to process URI  <a href="http://www.springframework.org/schema/util" rel="nofollow noreferrer">http://www.springframework.org/schema/util</a></p>
  
  <p>org.apache.cxf.jaxws.spring.NamespaceHandler to process URI  <a href="http://cxf.apache.org/jaxws" rel="nofollow noreferrer">http://cxf.apache.org/jaxws</a></p>
  
  <p>org.apache.cxf.transport.http.spring.NamespaceHandler to process URI  <a href="http://cxf.apache.org/transports/http/configuration" rel="nofollow noreferrer">http://cxf.apache.org/transports/http/configuration</a></p>
  
  <p>org.springframework.batch.core.configuration.xml.CoreNamespaceHandler to process URI  <a href="http://www.springframework.org/schema/batch" rel="nofollow noreferrer">http://www.springframework.org/schema/batch</a></p>
  
  <p>But when it is loading the above last class for batch URI, the following Exception occurs.</p>
  
  <pre><code>12/28/2017-11:21:47.070 - localhost-startStop-1 - ERROR [org.springframework.web.context.ContextLoader : Line 227]: Context initialization failed 
  org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [beans.xml]; nested exception is org.springframework.beans.FatalBeanException: Class [org.springframework.batch.core.configuration.xml.CoreNamespaceHandler] for namespace [http://www.springframework.org/schema/batch] does not implement the [org.springframework.beans.factory.xml.NamespaceHandler] interface
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
  </code></pre>
  
  <p>I looked into the source of all the above classes and found that all of them extend </p>
  
  <pre><code>org.springframework.beans.factory.xml.NamespaceHandlerSupport
  </code></pre>
  
  <p>which in turn implements</p>
  
  <pre><code>org.springframework.beans.factory.xml.NamespaceHandler
  </code></pre>
  
  <p>I have checked the jars on classpath and they look fine, containing the above classes and interfaces in respective, expected spring jar files.</p>
  
  <p>Any idea how to resolve this?</p>
  
  <p>Similar questions are here and I have tried whats given there.</p>
  
  <p><a href="https://stackoverflow.com/questions/38068558/unexpected-exception-parsing-xml-document-from-class-path-resource-config-faceb">Unexpected exception parsing XML document from class path resource [config/FaceBookSimulator.xml];</a></p>
  
  <p>and</p>
  
  <p><a href="https://stackoverflow.com/questions/8523997/unable-to-locate-spring-namespacehandler-for-xml-schema-namespace-http-www-sp">Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/batch]</a></p>
  
  <p><strong>Update</strong></p>
  
  <p>I restarted Tomcat with -verbose:class option to print all classes being loaded form whichever jar files. And I found the following:</p>
  
  <pre><code>12/28/2017-15:01:18.251 - localhost-startStop-1 - DEBUG [org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver : Line 156]: Loaded NamespaceHandler mappings:{
   http://www.springframework.org/schema/task=org.springframework.scheduling.config.TaskNamespaceHandler, 
   http://www.springframework.org/schema/p=org.springframework.beans.factory.xml.SimplePropertyNamespaceHandler, 
   http://cxf.apache.org/transports/http-jetty/configuration=org.apache.cxf.transport.http_jetty.spring.NamespaceHandler, 
   http://www.w3.org/2006/07/ws-policy=org.apache.cxf.ws.policy.spring.PolicyNamespaceHandler, 
   http://www.springframework.org/schema/lang=org.springframework.scripting.config.LangNamespaceHandler, 
   http://www.springframework.org/schema/util=org.springframework.beans.factory.xml.UtilNamespaceHandler, 
   http://cxf.apache.org/jaxws=org.apache.cxf.jaxws.spring.NamespaceHandler, 
   http://cxf.apache.org/policy=org.apache.cxf.ws.policy.spring.NamespaceHandler, 
   http://www.springframework.org/schema/jee=org.springframework.ejb.config.JeeNamespaceHandler, 
   http://cxf.apache.org/transports/jms=org.apache.cxf.transport.jms.spring.NamespaceHandler, 
   http://cxf.apache.org/transports/http/configuration=org.apache.cxf.transport.http.spring.NamespaceHandler, 
   http://www.springframework.org/schema/tx=org.springframework.transaction.config.TxNamespaceHandler, 
   http://cxf.apache.org/bindings/object=org.apache.cxf.binding.object.spring.NamespaceHandler, 
   http://cxf.apache.org/ws/addressing=org.apache.cxf.ws.addressing.spring.NamespaceHandler, 
   http://cxf.apache.org/clustering=org.apache.cxf.clustering.spring.NamespaceHandler, 
   http://cxf.apache.org/simple=org.apache.cxf.frontend.spring.NamespaceHandler, 
   http://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler, 
   http://www.springframework.org/schema/context=org.springframework.context.config.ContextNamespaceHandler, 
   http://cxf.apache.org/core=org.apache.cxf.bus.spring.NamespaceHandler, 
   http://cxf.apache.org/jaxrs=org.apache.cxf.jaxrs.spring.NamespaceHandler, 
   http://cxf.apache.org/binding/coloc=org.apache.cxf.binding.coloc.spring.NamespaceHandler, 
   http://schemas.xmlsoap.org/ws/2004/09/policy=org.apache.cxf.ws.policy.spring.PolicyNamespaceHandler, 
   http://www.springframework.org/schema/jms=org.springframework.jms.config.JmsNamespaceHandler, 
   http://www.springframework.org/schema/batch=org.springframework.batch.core.configuration.xml.CoreNamespaceHandler, 
   http://www.w3.org/ns/ws-policy=org.apache.cxf.ws.policy.spring.PolicyNamespaceHandler, 
   http://cxf.apache.org/ws/rm/manager=org.apache.cxf.ws.rm.spring.NamespaceHandler, 
   http://cxf.apache.org/bindings/soap=org.apache.cxf.binding.soap.spring.NamespaceHandler
  } 
  </code></pre>
  
  <p>The class </p>
  
  <pre><code>org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver
  </code></pre>
  
  <p>is processing:</p>
  
  <pre><code>http://www.springframework.org/schema/batch=org.springframework.batch.core.configuration.xml.CoreNamespaceHandler
  </code></pre>
  
  <p>The DefaultNamespaceHandlerResolver does not extend NamespaceHandlerSupport ( which implements NamespaceHandler).</p>
  
  <p>If the finding is right, how to resolve this?</p>