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

今天用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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值