title: Unable to locate Spring XML Schema Namespace Exception for the Spring Data JPA (only while deploying!)
body: <p>I have two Spring-Maven Projects. First one is for the <strong>backend</strong> (SpringDataJpa Repositories and Service Classes). It runs standalone (JUnits) without problem. </p>
  
  <p>The second one is for the <strong>frontend</strong> (SpringMVC), and this project defines the backend as a required project on the build path. Also in the Deployment assembly properties, I have added the backend project (WEB-INF/lib/Backend.jar), so it will be deployed too (Actually should not it be added here automatically when i define the backend as a dependency?)..</p>
  
  <p>Anyway, my main problem is this exception i get when i deploy the frontend project.</p>
  
  <pre><code>Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/data/jpa   
  </code></pre>
  
  <p>this exception occurs in the backend file "spring-jpa.cfg.xml" which looks like:</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:jpa="http://www.springframework.org/schema/data/jpa"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.springframework.org/schema/data/jpa
      http://www.springframework.org/schema/data/jpa/spring-jpa.xsd"&gt;
  
      &lt;jpa:repositories base-package="acn.spring.backend.springDataJpa" /&gt;
  
      &lt;bean id="entityManagerFactory"
          class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
          &lt;property name="dataSource" ref="dataSource"&gt;&lt;/property&gt;
          &lt;property name="jpaVendorAdapter"&gt;
              &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"&gt;
                  &lt;property name="showSql" value="true" /&gt;
                  &lt;property name="generateDdl" value="true" /&gt;
                  &lt;property name="databasePlatform" value="org.hibernate.dialect.MySQL5InnoDBDialect" /&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
          &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt;
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>In Backend-POM defined dependencies: all kinds of spring dependencies (3.2.4) and spring data jpa (1.4.1)
  In Frontend-POM defined dependencies: spring-mvc (3.2.4) </p>
  
  <p>First i thought that i should define the spring data jpa dependencies also in the frontend (although the frontend project does not have a direct dependency). It did not change anything.  </p>
  
  <p>Secondly in the build path properties of the backend, in the order export tab, i choose the maven dependencies, so it may export the dependencies of the backend to the dependent frontend project. It did not change also anything..</p>
  
  <p>I dont understand how this namespace can be found while running backend standalone, but not under <strong>tomcat</strong>. I would appreciate any ideas.</p>
  
  <p>This is the backend POM:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;SpringBusiness&lt;/groupId&gt;
      &lt;artifactId&gt;SpringBusiness&lt;/artifactId&gt;
      &lt;version&gt;0.0.2-SNAPSHOT&lt;/version&gt;
      &lt;build&gt;
          &lt;sourceDirectory&gt;src&lt;/sourceDirectory&gt;
          &lt;testSourceDirectory&gt;test&lt;/testSourceDirectory&gt;
          &lt;resources&gt;
              &lt;resource&gt;
                  &lt;directory&gt;resources&lt;/directory&gt;
                  &lt;excludes&gt;
                      &lt;exclude&gt;**/*.java&lt;/exclude&gt;
                  &lt;/excludes&gt;
              &lt;/resource&gt;
          &lt;/resources&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.3.2&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.6&lt;/source&gt;
                      &lt;target&gt;1.6&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;!-- Shared version number properties --&gt;
      &lt;properties&gt;
          &lt;org.springframework.version&gt;3.2.4.RELEASE&lt;/org.springframework.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;!-- Core utilities used by other modules. Define this if you use Spring 
              Utility APIs (org.springframework.core.*/org.springframework.util.*) --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Expression Language (depends on spring-core) Define this if you use 
              Spring Expression APIs (org.springframework.expression.*) --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-expression&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Bean Factory and JavaBeans utilities (depends on spring-core) Define 
              this if you use Spring Bean APIs (org.springframework.beans.*) --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Aspect Oriented Programming (AOP) Framework (depends on spring-core, 
              spring-beans) Define this if you use Spring AOP APIs (org.springframework.aop.*) --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-aop&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Application Context (depends on spring-core, spring-expression, spring-aop, 
              spring-beans) This is the central artifact for Spring's Dependency Injection 
              Container and is generally always defined --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Various Application Context utilities, including EhCache, JavaMail, 
              Quartz, and Freemarker integration Define this if you need any of these integrations --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-context-support&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Transaction Management Abstraction (depends on spring-core, spring-beans, 
              spring-aop, spring-context) Define this if you use Spring Transactions or 
              DAO Exception Hierarchy (org.springframework.transaction.*/org.springframework.dao.*) --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- JDBC Data Access Library (depends on spring-core, spring-beans, spring-context, 
              spring-tx) Define this if you use Spring's JdbcTemplate API (org.springframework.jdbc.*) --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-jdbc&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Object-to-Relation-Mapping (ORM) integration with Hibernate, JPA and 
              iBatis. (depends on spring-core, spring-beans, spring-context, spring-tx) 
              Define this if you need ORM (org.springframework.orm.*) --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Object-to-XML Mapping (OXM) abstraction and integration with JAXB, 
              JiBX, Castor, XStream, and XML Beans. (depends on spring-core, spring-beans, 
              spring-context) Define this if you need OXM (org.springframework.oxm.*) --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-oxm&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Support for testing Spring applications with tools such as JUnit and 
              TestNG This artifact is generally always defined with a 'test' scope for 
              the integration testing framework and unit testing stubs --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework.version}&lt;/version&gt;
              &lt;scope&gt;test&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.4.1.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.mockito&lt;/groupId&gt;
              &lt;artifactId&gt;mockito-all&lt;/artifactId&gt;
              &lt;version&gt;1.9.5&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.11&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;version&gt;5.1.26&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
              &lt;artifactId&gt;aspectjweaver&lt;/artifactId&gt;
              &lt;version&gt;1.7.3&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
              &lt;version&gt;4.2.6.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
              &lt;version&gt;1.7.5&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.17&lt;/version&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javassist&lt;/groupId&gt;
              &lt;artifactId&gt;javassist&lt;/artifactId&gt;
              &lt;version&gt;3.12.1.GA&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
              &lt;version&gt;5.0.1.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
              &lt;version&gt;4.2.6.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>And this is the frontend POM:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;acn.spring&lt;/groupId&gt;
      &lt;artifactId&gt;SpringShop&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.3.2&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.6&lt;/source&gt;
                      &lt;target&gt;1.6&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.3&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;warSourceDirectory&gt;WebContent&lt;/warSourceDirectory&gt;
                      &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;properties&gt;
          &lt;org.springframework.version&gt;3.2.4.RELEASE&lt;/org.springframework.version&gt;
          &lt;org.springframework.security.version&gt;3.1.4.RELEASE&lt;/org.springframework.security.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-web&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework.security.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-config&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework.security.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;jstl&lt;/groupId&gt;
              &lt;artifactId&gt;jstl&lt;/artifactId&gt;
              &lt;version&gt;1.2&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-mapper-asl&lt;/artifactId&gt;
              &lt;version&gt;1.7.1&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>This is my application-context.xml in the backend:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:context="http://www.springframework.org/schema/context"
      xsi:schemaLocation=
      "http://www.springframework.org/schema/beans 
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt;
  
      &lt;context:annotation-config /&gt;
  
      &lt;!-- Database Access --&gt;
      &lt;import resource="data-source.xml"/&gt;
      &lt;import resource="spring-jpa.cfg.xml"/&gt;
  
      &lt;!-- Middle Layer --&gt;
      &lt;import resource="aop-context.xml"/&gt;
      &lt;import resource="transaction-context.xml"/&gt;
      &lt;import resource="service-context.xml"/&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>This is the web.xml of the fronted, where i define the application context as a dependency (So i don't define the spring-jpa.cfg.xml again):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"&gt;
      &lt;display-name&gt;SpringShop&lt;/display-name&gt;
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  
      &lt;!-- needed for ContextLoaderListener --&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;classpath:application-context.xml, /WEB-INF/spring-security.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  ....
  </code></pre>
  
  <p>Web Deployment Assembly for the Frontend: (SpringBusiness is the name of the backend project)</p>
  
  <p><img src="https://i.stack.imgur.com/YtXOv.png" alt="enter image description here"></p>
  
  <p><strong>EDIT: When I define all my dependencies (which are actually used just from the backend) also in the frontend pom, i dont get the exception. What is the correct way of doing this? It does not make any sense to define all the dependencies again, since the backend jar is already defined in the deployment assembly of the frontend..</strong></p>