cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration

来源:互联网 发布:在淘宝退货卖家拒收 编辑:程序博客网 时间:2024/06/10 16:03

今天用Myeclipse 10创建springMVC+mybatis+ehcache,创建一个新的 web 项目,将使用基于SpringMVC的web项目。如果您使用 Eclipse 请确保你有 m2eclipse 安装,然后创建一个Maven项目使用 JEE 5 web 应用程序原型,按步骤完成后

spring-servlet.xml配置文件报错

cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'ehcache:annotation-driven'.

意思是无法识别ehcache:annotation-driven这个标签,

<?xml version="1.0" encoding="UTF-8"?><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:oxm="http://www.springframework.org/schema/oxm"    xmlns:mvc="http://www.springframework.org/schema/mvc"    xmlns:ehcache="http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring"    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        http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd        http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd">  <ehcache:annotation-driven />      <ehcache:config cache-manager="cacheManager">        <ehcache:evict-expired-elements interval="60" />    </ehcache:config>    <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">        <property name="configLocation"  value="/WEB-INF/ehcache.xml"/>    </bean>  </beans> 


解决方案:

1、将ehcache-spring-annotations-1.1.2.jar拷贝到项目的lib目录下;
2、选择myelcipse的window-->preferences,弹出相应对话框;
3、在Myeclipse-->Files and Editors-->XML-->XML Catalog(也可以直接搜xml catalog),点击进入;
4、选择User Specified Entries,单击添加,然后, 在弹出的对话框相应位置填入
Location:TestMavenProject/src/main/webapp/WEB-INF/lib/ehcache-spring-annotations-1.1.2.jar!

               /com/googlecode/ehcache/annotations/ehcache-spring-1.1.xsd 
Key Type: System Id
Key: http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd

注:TestMavenProject/src/main/webapp/WEB-INF/lib/ehcache-spring-annotations-1.1.2.jar是项目中jar包所在路径

打开jar包下的spring.schemas文件:

http\://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.0.xsd

    =com/googlecode/ehcache/annotations/ehcache-spring-1.0.xsd
http\://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd

   =com/googlecode/ehcache/annotations/ehcache-spring-1.1.xsd



阅读全文
0 0
原创粉丝点击