title: "matching wildcard is strict, but no declaration can be found" error and "failed read schema" error
body: <p>I'm training myself with spring and mybatis exercises.</p>
  
  <p>I'm trying to solve these two errors since yesterday:</p>
  
  <p>1)</p>
  
  <blockquote>
    <p>Description   Resource    Path    Location    Type cvc-complex-type.2.4.c: The
    matching wildcard is strict, but no declaration can be found for
    element
    'context:annotation-config'.  ApplicationContext.xml  /Example/WebContent/WEB-INF line
    14    XML Problem</p>
  </blockquote>
  
  <p>for these lines:</p>
  
  <pre><code>&lt;context:component-scan base-package="Controller" /&gt;
  &lt;context:component-scan base-package="service"/&gt;
  &lt;context:component-scan base-package="test.dao.samp"/&gt;
  &lt;context:component-scan base-package="test.model.samp"/&gt;
  </code></pre>
  
  <p>and this:</p>
  
  <p>2)</p>
  
  <blockquote>
    <p>Description   Resource    Path    Location    Type</p>
    
    <p>schema_reference.4: Failed to read schema document '<a href="http://www.springframework.org/schema/context/spring-context-4.0.xsd" rel="nofollow">http://www.springframework.org/schema/context/spring-context-4.0.xsd</a>',
    because 1) could not find the document; 2) the document could not be
    read; 3) the root element of the document is not
    . ApplicationContext.xml  /Exemple/WebContent/WEB-INF line
    14    XML Problem</p>
    
    <p>schema_reference.4: Failed to read schema document
    '<a href="http://www.springframework.org/schema/tx/spring-tx-4.0.xsd" rel="nofollow">http://www.springframework.org/schema/tx/spring-tx-4.0.xsd</a>', because
    1) could not find the document; 2) the document could not be read; 3)
    the root element of the document is not
    . ApplicationContext.xml  /Exemple/WebContent/WEB-INF line
    51    XML Problem</p>
  </blockquote>
  
  <p>Here is my ApplicationContext.xml</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
          xmlns:mvc="http://www.springframework.org/schema/mvc"
          xmlns:tx="http://www.springframework.org/schema/tx"
          xmlns:context="http://www.springframework.org/schema/context"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="
          http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
          http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"&gt;
  
               &lt;context:annotation-config/&gt;
  
  
          &lt;context:component-scan base-package="Controller" /&gt;
          &lt;context:component-scan base-package="service"/&gt;
          &lt;context:component-scan base-package="test.dao.samp"/&gt;
          &lt;context:component-scan base-package="test.model.samp"/&gt;
  
           &lt;bean id='dataSource'
              class='org.springframework.jdbc.datasource.SimpleDriverDataSource'&gt;
              &lt;property name='driverClass' value='org.apache.derby.jdbc.EmbeddedDriver' /&gt;
              &lt;property name='url'
                  value='jdbc:derby:C:\Users\XXX\IBM\rationalsdp\workspace\.metadata\.plugins\com.ibm.datatools.db2.cloudscape.driver\SAMPLE;create=true' /&gt;
              &lt;property name='username' value='admin' /&gt;
              &lt;property name='password' value='admin' /&gt;
          &lt;/bean&gt;
  
          &lt;bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"&gt;
              &lt;property name="dataSource" ref="dataSource" /&gt;
              &lt;property name="configLocation" value="WEB-INF\psaIbatisConf.xml" /&gt;
          &lt;/bean&gt;
  
          &lt;bean id="sqlMapClient" class="org.mybatis.spring.SqlSessionTemplate"&gt;
              &lt;constructor-arg ref="sqlSessionFactory" /&gt;
          &lt;/bean&gt;
  
          &lt;!-- TRANSACTION MANAGER --&gt;
          &lt;bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"&gt;
            &lt;property name="dataSource" ref="dataSource"/&gt;
          &lt;/bean&gt;
  
          &lt;!-- ANNOTATION DRIVEN TRANSACTIONS --&gt;
          &lt;tx:annotation-driven transaction-manager="transactionManager" /&gt;
  
  
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>How I have understood, the errors come from the wrong xsd declaration, but I checked them a lot of times. </p>
  
  <p>The jars I'm using are all 4.0.4 version.</p>
  
  <p>I'm using RAD, Websphere, spring e myBatis with myBatis generator.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I changed the version schema in the beans tag in this way:</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:util="http://www.springframework.org/schema/util" 
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:tx="http://www.springframework.org/schema/tx"
      xsi:schemaLocation="
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
          http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt;
  </code></pre>
  
  <p>The firsts errors has disappeared, but the last one (line 51) remained.  </p>