Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring 3.1 Cache namespace problem

Tags:

caching

spring

i am trying to use 3.1 spring cache configuration and namespaces as per spring doc. i have also downloaded latest jar from spring site but still i am getting this problem regarding namespaces

Unable to locate Spring NamespaceHandler for element 'cache:annotation-driven' of schema namespace 'http://www.springframework.org/

schema/cache'

spring config file

<?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:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
    http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">


cache:annotation-driven />

<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" p:cache-manager-ref="ehcache"/>
<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" 
    p:config-location="classpath:ehcache.xml"/>
like image 228
Vish Avatar asked Dec 18 '25 16:12

Vish


1 Answers

you need spring-context-support.jar and spring-context.jar on the classpath.

spring-context has the CacheNamespaceHandler class.

(note that spring is now using a different naming scheme for their jars, but context and context support are retained in the names)

like image 95
Bozho Avatar answered Dec 20 '25 13:12

Bozho



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!