title: Spring BeanDefinitionParsingException
body: <p>i am getting the following error below:</p>
  
  <blockquote>
    <p>org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
    Configuration problem: Unable to
    locate Spring NamespaceHandler for XML
    schema namespace
    [http://www.springframework.org/schema/mvc]
    Offending resource: ServletContext
    resource
    [/WEB-INF/raceLeague-servlet.xml]</p>
    
    <p>org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
      org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
      org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
      org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:281)
      org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1294)
      org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)
      org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
      org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
      org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
      org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
      org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
      org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
      org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
      org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
      org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
      org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
      org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
      org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
      org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
      org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
      org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:402)
      org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:316)
      org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:282)
      org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
      javax.servlet.GenericServlet.init(GenericServlet.java:160)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:380)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
      org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
      java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
    Source)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
    Source)   java.lang.Thread.run(Unknown
    Source)</p>
  </blockquote>
  
  <p>Im not too sure why but im guessing somethings wrong with my servlett.xml? below is the file:</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"
          xmlns:mvc="http://www.springframework.org/schema/mvc"
          xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
                  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;mvc:annotation-driven /&gt;
  
      &lt;bean
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
          &lt;property name="prefix" value="/WEB-INF/jsp/" /&gt;
          &lt;property name="suffix" value=".jsp" /&gt;
      &lt;/bean&gt;
  
      &lt;context:component-scan base-package="com.jr" /&gt;
  
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>The Spring library i am using is from here <a href="http://www.springsource.com/download/community" rel="nofollow">http://www.springsource.com/download/community</a> . i saw two sets of jar files. one in dist folder and one in src folder. i used the jar files in the dist folder and added it to my WEB-INF/lib folder.</p>
  
  <p>here is my lib folder:</p>
  
  <pre><code>28/02/2005  16:32           999,966 ant-1.6.2.jar
  
  28/02/2005  16:32             5,659 ant-antlr-1.6.2.jar
  
  28/02/2005  16:32            73,665 ant-junit-1.6.2.jar
  
  28/02/2005  16:32             8,673 ant-launcher-1.6.2.jar
  
  28/02/2005  16:32             6,755 ant-swing-1.6.2.jar
  
  18/08/2010  11:36           443,432 antlr-2.7.6.jar
  
  28/02/2005  16:32             1,221 antlr.license.txt
  
  29/11/2009  23:03           345,048 apache-mime4j-0.6.jar
  
  28/02/2005  16:32            11,358 apache.license-2.0.txt
  
  28/02/2005  16:32             2,660 apache.license.txt
  
  28/02/2005  16:32           397,997 c3p0-0.8.5.jar
  
  28/02/2005  16:32            26,430 c3p0.license.txt
  
  13/09/2010  13:54           322,362 cglib-nodep-2.2.jar
  
  28/02/2005  16:32           142,704 cleanimports.jar
  
  30/07/2010  11:51           232,019 commons-beanutils-1.8.3.jar
  
  29/11/2009  23:02            46,725 commons-codec-1.3.jar
  
  28/02/2005  16:32           175,426 commons-collections-2.1.1.jar
  
  18/08/2010  11:36           559,366 commons-collections-3.1.jar
  
  30/07/2010  11:48           575,389 commons-collections-3.2.1.jar
  
  07/02/2010  11:56           707,465 commons-dbcp-1.4-javadoc.jar
  
  07/02/2010  11:55           159,513 commons-dbcp-1.4-sources.jar
  
  07/02/2010  11:52           160,519 commons-dbcp-1.4.jar
  
  23/09/2010  09:10            59,590 commons-fileupload-1.2.2.jar
  
  23/09/2010  09:10           109,043 commons-io-1.4.jar
  
  30/07/2010  11:35           279,193 commons-lang-2.5.jar
  
  28/02/2005  16:32            38,015 commons-logging-1.0.4.jar
  
  01/11/2009  14:58            60,686 commons-logging-1.1.1.jar
  30/07/2010  10:27            60,841 commons-logging.jar
  
  
  12/11/2009  19:43           436,817 commons-pool-1.5.4-javadoc.jar
  
  12/11/2009  19:43            96,194 commons-pool-1.5.4-sources.jar
  
  12/11/2009  19:38            96,221 commons-pool-1.5.4.jar
  
  28/02/2005  16:32           171,071 concurrent-1.3.2.jar
  
  28/02/2005  16:32            17,978 connector.jar
  
  28/02/2005  16:32             9,790 connector.licence.txt
  
  28/02/2005  16:32           312,509 dom4j-1.5.2.jar
  
  18/08/2010  11:36           313,898 dom4j-1.6.1.jar
  
  28/02/2005  16:32            47,531 ehcache-1.1.jar
  
  30/07/2010  11:42            86,487 ezmorph-1.0.6.jar
  
  27/05/2010  16:38           100,884 hibernate-jpa-2.0-api-1.0.0.Final
  
  11/06/2009  17:35         2,220,643 hibernate3.jar
  
  03/12/2009  22:43           291,039 httpclient-4.0.1.jar
  
  29/11/2009  23:05           172,888 httpcore-4.0.1.jar
  
  03/12/2009  22:43            25,443 httpmime-4.0.1.jar
  
  28/02/2005  16:32           104,359 jaas.jar
  
  28/02/2005  16:32             9,863 jaas.licence.txt
  
  28/02/2005  16:32            24,180 jacc-1_0-fr.jar
  
  18/08/2010  11:36           597,476 javassist-3.9.0.GA.jar
  
  28/02/2005  16:32           239,006 jaxen-1.1-beta-4.jar
  
  28/02/2005  16:32           342,872 jboss-cache.jar
  
  28/02/2005  16:32           389,484 jboss-common.jar
  
  28/02/2005  16:32           588,329 jboss-jmx.jar
  
  28/02/2005  16:32           165,248 jboss-remoting.jar
  
  28/02/2005  16:32           215,223 jboss-system.jar
  
  28/02/2005  16:32             6,727 jdbc2_0-stdext.jar
  
  28/02/2005  16:32             7,932 jdbc2_0-stdext.licence.txt
  
  28/02/2005  16:32         1,652,084 jgroups-2.2.7.jar
  
  30/07/2010  09:42           151,390 json-lib-2.3-jdk13.jar
  
  30/07/2010  11:39           151,839 json-lib-2.3-jdk15.jar
  
  30/07/2010  11:58           414,240 jstl-1.2.jar
  
  18/08/2010  11:47            10,899 jta-1.1.jar
  
  28/02/2005  16:32             8,812 jta.jar
  
  
  28/02/2005  16:32             9,830 jta.licence.txt
  
  28/02/2005  16:32           121,070 junit-3.8.1.jar
  
  28/02/2005  16:32           352,291 log4j-1.2.9.jar
  
  
  10/09/2010  16:12           236,079 mysql-connector-java-3.0.16-ga-bi
  
  10/09/2010  16:12           391,434 mysql-connector-java-3.1.6-bin.ja
  
  23/06/2010  16:38           767,492 mysql-connector-java-5.1.13-bin.j
  
  20/10/2010  16:21           321,190 org.springframework.aop-3.0.5.REL
  
  20/10/2010  16:21            53,082 org.springframework.asm-3.0.5.REL
  
  20/10/2010  16:21            35,548 org.springframework.aspects-3.0.5
  r
  20/10/2010  16:21           555,410 org.springframework.beans-3.0.5.R
  
  20/10/2010  16:21           668,861 org.springframework.context-3.0.5
  r
  20/10/2010  16:21           100,870 org.springframework.context.suppo
  LEASE.jar
  20/10/2010  16:21           382,442 org.springframework.core-3.0.5.RE
  
  20/10/2010  16:21           169,752 org.springframework.expression-3.
  .jar
  20/10/2010  16:21             1,810 org.springframework.instrument-3.
  .jar
  20/10/2010  16:21             5,728 org.springframework.instrument.to
  RELEASE.jar
  20/10/2010  16:21           385,712 org.springframework.jdbc-3.0.5.RE
  
  20/10/2010  16:21           185,312 org.springframework.jms-3.0.5.REL
  
  20/10/2010  16:21           334,327 org.springframework.orm-3.0.5.REL
  
  20/10/2010  16:21            61,379 org.springframework.oxm-3.0.5.REL
  
  20/10/2010  16:21           205,278 org.springframework.test-3.0.5.RE
  
  20/10/2010  16:21           231,922 org.springframework.transaction-3
  E.jar
  20/10/2010  16:21           395,587 org.springframework.web-3.0.5.REL
  20/10/2010  16:21           175,412 org.springframework.web.portlet-3
  
  E.jar
  20/10/2010  16:21           418,977 org.springframework.web.servlet-3
  E.jar
  20/10/2010  16:21            31,404 org.springframework.web.struts-3.
  .jar
  28/02/2005  16:32           114,308 oscache-2.1.jar
  
  28/02/2005  16:32           475,943 proxool-0.8.3.jar
  
  28/02/2005  16:30             2,862 README.txt
  
  27/05/2010  11:29            22,338 slf4j-api-1.5.6.jar
  
  18/08/2010  11:26            23,445 slf4j-api-1.5.8.jar
  
  27/05/2010  11:30             9,678 slf4j-log4j12-1.5.6.jar
  
  31/10/2008  17:25           325,942 spring-aop.jar
  
  31/10/2008  17:25           488,282 spring-beans.jar
  
  31/10/2008  17:25            96,880 spring-context-support.jar
  
  31/10/2008  17:25           476,940 spring-context.jar
  
  31/10/2008  17:25           285,491 spring-core.jar
  
  31/10/2008  17:25           335,484 spring-jdbc.jar
  
  31/10/2008  17:25           195,350 spring-jms.jar
  
  31/10/2008  17:25           377,805 spring-orm.jar
  
  31/10/2008  17:25           180,924 spring-test.jar
  
  31/10/2008  17:25           231,173 spring-tx.jar
  
  31/10/2008  17:25           194,577 spring-web.jar
  31/10/2008  17:25           149,683 spring-webmvc-portlet.jar
  
  31/10/2008  17:25            36,748 spring-webmvc-struts.jar
  
  31/10/2008  17:25           402,396 spring-webmvc.jar
  
  31/10/2008  17:25         2,949,500 spring.jar
  
  28/02/2005  16:32            30,602 swarmcache-1.0rc2.jar
  
  27/05/2010  11:29            47,433 validation-api-1.0.0.GA.jar
  
  28/02/2005  16:30             4,538 version.properties
  
  28/02/2005  16:32             5,762 versioncheck.jar
  
  28/02/2005  16:32         1,010,806 xerces-2.6.2.jar
  
  28/02/2005  16:32           123,705 xml-apis.jar
  </code></pre>
  
  <p>web.xml file here as well</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      version="2.5"&gt;
  
  
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;
  
          &lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
  
      &lt;!-- index.htm web page --&gt;
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;
              index.jsp
      &lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  
      &lt;!-- Register and setup my servlet xml files here --&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;raceLeague&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;raceLeague&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.htm&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;      
  </code></pre>
  
  <p>Here is my build script too:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  
  &lt;project name="Online Racing League" basedir="." default="usage"&gt;
      &lt;property file="build.properties"/&gt;
  
      &lt;property name="src.dir" value="src"/&gt;
      &lt;property name="web.dir" value="war"/&gt;
      &lt;property name="build.dir" value="${web.dir}/WEB-INF/classes"/&gt;
      &lt;property name="name" value="Online Racing League"/&gt;
  
      &lt;path id="master-classpath"&gt;
          &lt;fileset dir="${web.dir}/WEB-INF/lib"&gt;
              &lt;include name="*.jar"/&gt;
          &lt;/fileset&gt;
          &lt;!-- We need the servlet API classes: --&gt;
          &lt;!--  * for Tomcat 5/6 use servlet-api.jar --&gt;
          &lt;!--  * for other app servers - check the docs --&gt;
          &lt;fileset dir="${appserver.lib}"&gt;
              &lt;include name="servlet*.jar"/&gt;
          &lt;/fileset&gt;
          &lt;pathelement path="${build.dir}"/&gt;
      &lt;/path&gt;
  
      &lt;target name="usage"&gt;
          &lt;echo message=""/&gt;
          &lt;echo message="${name} build file"/&gt;
          &lt;echo message="-----------------------------------"/&gt;
          &lt;echo message=""/&gt;
          &lt;echo message="Available targets are:"/&gt;
          &lt;echo message=""/&gt;
          &lt;echo message="build     --&gt; Build the application"/&gt;
          &lt;echo message="deploy    --&gt; Deploy application as directory"/&gt;
          &lt;echo message="deploywar --&gt; Deploy application as a WAR file"/&gt;
          &lt;echo message="install   --&gt; Install application in Tomcat"/&gt;
          &lt;echo message="reload    --&gt; Reload application in Tomcat"/&gt;
          &lt;echo message="start     --&gt; Start Tomcat application"/&gt;
          &lt;echo message="stop      --&gt; Stop Tomcat application"/&gt;
          &lt;echo message="list      --&gt; List Tomcat applications"/&gt;
          &lt;echo message=""/&gt;
      &lt;/target&gt;
  
      &lt;target name="build" description="Compile main source tree java files"&gt;
          &lt;mkdir dir="${build.dir}"/&gt;
          &lt;javac destdir="${build.dir}" source="1.5" target="1.5" debug="true"
                 deprecation="false" optimize="false" failonerror="true"&gt;
              &lt;src path="${src.dir}"/&gt;
              &lt;classpath refid="master-classpath"/&gt;
          &lt;/javac&gt;
      &lt;/target&gt;
  
      &lt;target name="deploy" depends="build" description="Deploy application"&gt;
          &lt;copy todir="${deploy.path}/${name}" preservelastmodified="true"&gt;
              &lt;fileset dir="${web.dir}"&gt;
                  &lt;include name="**/*.*"/&gt;
              &lt;/fileset&gt;
          &lt;/copy&gt;
      &lt;/target&gt;
  
      &lt;target name="deploywar" depends="build" description="Deploy application as a WAR file"&gt;
          &lt;war destfile="${deploy.path}/${name}.war"
               webxml="${web.dir}/WEB-INF/web.xml"&gt;
              &lt;fileset dir="${web.dir}"&gt;
                  &lt;include name="**/*.*"/&gt;
              &lt;/fileset&gt;
          &lt;/war&gt;
          &lt;copy todir="${deploy.path}" preservelastmodified="true"&gt;
              &lt;fileset dir="."&gt;
                  &lt;include name="*.war"/&gt;
              &lt;/fileset&gt;
          &lt;/copy&gt;
      &lt;/target&gt;
  
  
  
      &lt;!-- ============================================================== --&gt;
      &lt;!-- Tomcat tasks - remove these if you don't have Tomcat installed --&gt;
      &lt;!-- ============================================================== --&gt;
  
          &lt;path id="catalina-ant-classpath"&gt;
              &lt;!-- We need the Catalina jars for Tomcat --&gt;
              &lt;!--  * for other app servers - check the docs --&gt;
              &lt;fileset dir="${appserver.lib}"&gt;
                  &lt;include name="catalina-ant.jar"/&gt;
              &lt;/fileset&gt;
          &lt;/path&gt;
  
          &lt;taskdef name="install" classname="org.apache.catalina.ant.DeployTask"&gt;
              &lt;classpath refid="catalina-ant-classpath"/&gt;
          &lt;/taskdef&gt;
          &lt;taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"&gt;
              &lt;classpath refid="catalina-ant-classpath"/&gt;
          &lt;/taskdef&gt;
          &lt;taskdef name="list" classname="org.apache.catalina.ant.ListTask"&gt;
              &lt;classpath refid="catalina-ant-classpath"/&gt;
          &lt;/taskdef&gt;
          &lt;taskdef name="start" classname="org.apache.catalina.ant.StartTask"&gt;
              &lt;classpath refid="catalina-ant-classpath"/&gt;
          &lt;/taskdef&gt;
          &lt;taskdef name="stop" classname="org.apache.catalina.ant.StopTask"&gt;
              &lt;classpath refid="catalina-ant-classpath"/&gt;
          &lt;/taskdef&gt;
  
          &lt;target name="install" description="Install application in Tomcat"&gt;
              &lt;install url="${tomcat.manager.url}"
                       username="${tomcat.manager.username}"
                       password="${tomcat.manager.password}"
                       path="/${name}"
                       war="${name}"/&gt;
          &lt;/target&gt;
  
          &lt;target name="reload" description="Reload application in Tomcat"&gt;
              &lt;reload url="${tomcat.manager.url}"
                       username="${tomcat.manager.username}"
                       password="${tomcat.manager.password}"
                       path="/${name}"/&gt;
          &lt;/target&gt;
  
          &lt;target name="start" description="Start Tomcat application"&gt;
              &lt;start url="${tomcat.manager.url}"
                       username="${tomcat.manager.username}"
                       password="${tomcat.manager.password}"
                       path="/${name}"/&gt;
          &lt;/target&gt;
  
          &lt;target name="stop" description="Stop Tomcat application"&gt;
              &lt;stop url="${tomcat.manager.url}"
                       username="${tomcat.manager.username}"
                       password="${tomcat.manager.password}"
                       path="/${name}"/&gt;
          &lt;/target&gt;
  
          &lt;target name="list" description="List Tomcat applications"&gt;
              &lt;list url="${tomcat.manager.url}"
                       username="${tomcat.manager.username}"
                       password="${tomcat.manager.password}"/&gt;
          &lt;/target&gt;
  
      &lt;!-- End Tomcat tasks --&gt;
  
      &lt;/project&gt;
  </code></pre>
  
  <p>build.properties file below:</p>
  
  <pre><code># Ant properties for building the springapp
  
  appserver.home=C:/Program Files/Apache Software Foundation/Tomcat 7.0
  # for Tomcat 5 use $appserver.home}/server/lib
  # for Tomcat 6 use $appserver.home}/lib
  appserver.lib=${appserver.home}/lib/
  
  deploy.path=${appserver.home}/webapps
  
  tomcat.manager.url=http://localhost:8080/manager
  tomcat.manager.username=
  tomcat.manager.password=
  </code></pre>