title: Unable to locate Spring NamespaceHandler for XML schema namespace http://www.springframework.org/schema/data/jpa
body: <p>I am using spring and hibernate in my java project which is managed by maven. I created an assembly (jar with dependencies) using following command <code>mvn install assembly:assembly</code></p>
  
  <p>Now, when I am trying to run my main class with the command: <code>java -cp xyz-1.0-SNAPSHOT-jar-with-dependencies.jar com.xyz.class</code> then I am getting following error:</p>
  
  <pre><code>org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/data/jpa]**
  Offending resource: class path resource [xyz-component-scans-config.xml]
  
      at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
      at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
      at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
      at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:271)
  .
  .
  </code></pre>
  
  <p>I am not understanding that why it is not able to find the NamespaceHandler? as I already have following dependencies in pom.</p>
  
  <pre><code>    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework&lt;/groupId&gt;
        &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
        &lt;version&gt;3.1.0.RELEASE&lt;/version
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
        &lt;artifactId&gt;spring-data-jpa&lt;/artifactId&gt;
        &lt;version&gt;1.0.2.RELEASE&lt;/version&gt;
        &lt;type&gt;jar&lt;/type&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt; 
      &lt;dependency&gt;
        &lt;groupId&gt;org.springframework&lt;/groupId&gt;
        &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
        &lt;version&gt;3.1.0.RELEASE&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>I did try the suggestion in the following thread, but it didn't work for me.
  <a href="https://stackoverflow.com/questions/8785613/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/data/jpa]</a></p>
  
  <p>Source code for <a href="https://zgrepcode.com/spring-framework/5.1.4/spring-beans/org/springframework/beans/factory/parsing/beandefinitionparsingexception.java" rel="nofollow noreferrer">org.springframework.beans.factory.parsing.BeanDefinitionParsingException</a></p>