title: The matching wildcard is strict, but no declaration can be found for element 'mvc:annotation-driven'
body: <p>i get the following error when trying to run my spring 3.1.0 MVC app via Tomcat 7:</p>
  
  <blockquote>
    <p>The matching wildcard is strict, but no declaration can be found for
    element 'mvc:annotation-driven'.</p>
  </blockquote>
  
  <p>Here is my mvc-config.xml</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/beans      
          http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
          http://www.springframework.org/schema/mvc/
          http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd"&gt;
  
      &lt;mvc:annotation-driven /&gt;
  
      &lt;!-- the application context definition for the springapp DispatcherServlet --&gt;
  
  
      &lt;mvc:view-controller path="/" view-name="index" /&gt;
  
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>And here is my servlet</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.1.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context-3.1.xsd"&gt;
  
      &lt;import resource="mvc-config.xml" /&gt;
  
      &lt;bean
          class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" /&gt;
  
      &lt;bean
          class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /&gt;
  
      &lt;context:component-scan base-package="com.jr.freedom.controllers"&gt;&lt;/context:component-scan&gt;
  
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>Finally, here is the full exception from tomcat 7</p>
  
  <pre><code>&gt; org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
  &gt; Configuration problem: Failed to import bean definitions from relative
  &gt; location [mvc-config.xml] Offending resource: ServletContext resource
  &gt; [/WEB-INF/FreedomSpring-servlet.xml]; nested exception is
  &gt; org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
  &gt; Line 11 in XML document from ServletContext resource
  &gt; [/WEB-INF/mvc-config.xml] is invalid; nested exception is
  &gt; org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching
  &gt; wildcard is strict, but no declaration can be found for element
  &gt; 'mvc:annotation-driven'.  at
  &gt; org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
  &gt;   at
  &gt; org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
  &gt;   at
  &gt; org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
  &gt;   at
  &gt; org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:271)
  &gt;   at
  &gt; org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:196)
  &gt;   at
  &gt; org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:181)
  &gt;   at
  &gt; org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140)
  &gt;   at
  &gt; org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111)
  &gt;   at
  &gt; org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
  &gt;   at
  &gt; org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
  &gt;   at
  &gt; org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
  &gt;   at
  &gt; org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
  &gt;   at
  &gt; org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
  &gt;   at
  &gt; org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
  &gt;   at
  &gt; org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
  &gt;   at
  &gt; org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
  &gt;   at
  &gt; org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
  &gt;   at
  &gt; org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
  &gt;   at
  &gt; org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:522)
  &gt;   at
  &gt; org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
  &gt;   at
  &gt; org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631)
  &gt;   at
  &gt; org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588)
  &gt;   at
  &gt; org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
  &gt;   at
  &gt; org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
  &gt;   at
  &gt; org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
  &gt;   at
  &gt; org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
  &gt;   at javax.servlet.GenericServlet.init(GenericServlet.java:160)   at
  &gt; org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
  &gt;   at
  &gt; org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
  &gt;   at
  &gt; org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
  &gt;   at
  &gt; org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5015)
  &gt;   at
  &gt; org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5302)
  &gt;   at
  &gt; org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  &gt;   at
  &gt; org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:897)
  &gt;   at
  &gt; org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:873)
  &gt;   at
  &gt; org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
  &gt;   at
  &gt; org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958)
  &gt;   at
  &gt; org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599)
  &gt;   at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
  &gt; Source)   at java.util.concurrent.FutureTask$Sync.innerRun(Unknown
  &gt; Source)   at java.util.concurrent.FutureTask.run(Unknown Source)  at
  &gt; java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
  &gt;   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  &gt;   at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>Edit. here is my build.xml</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;project name="springapp" 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="FreedomSpring"/&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="${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;echo message="deploy path =  ${deploy.path}/${name}"/&gt;
          &lt;install url="${tomcat.manager.url}"
                   username="${tomcat.manager.username}"
                   password="${tomcat.manager.password}"
                   path="${deploy.path}/${name}"
                   war="${deploy.path}/"/&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="${deploy.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="${deploy.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>