Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EhCacheInterceptor not triggering #87

Open
GoogleCodeExporter opened this issue Mar 30, 2015 · 6 comments
Open

EhCacheInterceptor not triggering #87

GoogleCodeExporter opened this issue Mar 30, 2015 · 6 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1.Using spring mvc 3.0, create a controller called MarketQuotesController 

2. Create a method like this one on the controller:

@RequestMapping(value="/commodity", method=RequestMethod.GET)
    public @ResponseBody Commodity getCommodity(@RequestParam int commodityId) {
        return this.getReferenceDataService().getCommodity(commodityId);
    }


3. Create an interface of a DAO to get the commodity:
public interface CommodityLookupDAO {
    public Commodity getCommodityById(Integer commodityId);
}

4. Create the implementation
public class CommodityLookupDAOImpl implements CommodityLookupDAO {
(...)
    @Override
    @Cacheable(cacheName="commodityCache")
    public Commodity getCommodityById(Integer commodityId) {
        return super.find(commoditySqlById, new CommodityLookupMapper(), commodityId);
    }
}

5.Implementing ReferenceDataService:

@Override
    public Commodity getCommodity(Integer id) {
        return commodityDAO.getCommodityById(id);
    }

6. Setting up this spring context:
<bean id="cacheManager" 
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">   
         <property name="configLocation" value="/WEB-INF/ehcache.xml" />
    </bean> 

    <ehcache:config cache-manager="cacheManager">
        <ehcache:evict-expired-elements interval="60" />
    </ehcache:config>

    <ehcache:annotation-driven cache-manager="cacheManager" />

7. Having this as ehcache.xml

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd">    

    <defaultCache eternal="false" maxElementsInMemory="500" overflowToDisk="false" />           

    <cache name="commodityCache" maxElementsInMemory="500" eternal="false" overflowToDisk="false" />  

 </ehcache>

8. Have spring injecting:
    -The implementation of the service in the controller.
    -The implementation of the DAO in the service.


What is the expected output? What do you see instead?

The expected output is the interceptor generating the key for the cache. This 
is all I get on the logging side after executing several requests to the 
"cached" method:

<oct 14 18:26:36.120> <DEBUG> <net.sf.ehcache.config.ConfigurationFactory:148> 
- Configuring ehcache from InputStream
<oct 14 18:26:36.139> <DEBUG> <net.sf.ehcache.config.BeanHandler:271> - 
Ignoring ehcache attribute xmlns:xsi
<oct 14 18:26:36.140> <DEBUG> <net.sf.ehcache.config.BeanHandler:271> - 
Ignoring ehcache attribute xsi:noNamespaceSchemaLocation
<oct 14 18:26:36.194> <DEBUG> <net.sf.ehcache.util.PropertyUtil:88> - 
propertiesString is null.
<oct 14 18:26:36.199> <DEBUG> <net.sf.ehcache.CacheManager:605> - No disk store 
path defined. Skipping disk store path conflict test.
<oct 14 18:26:36.200> <DEBUG> <net.sf.ehcache.config.ConfigurationHelper:184> - 
No CacheManagerEventListenerFactory class specified. Skipping...
<oct 14 18:26:36.248> <DEBUG> <net.sf.ehcache.Cache:949> - No 
BootstrapCacheLoaderFactory class specified. Skipping...
<oct 14 18:26:36.248> <DEBUG> <net.sf.ehcache.Cache:923> - CacheWriter factory 
not configured. Skipping...
<oct 14 18:26:36.257> <DEBUG> <net.sf.ehcache.config.ConfigurationHelper:96> - 
No CacheExceptionHandlerFactory class specified. Skipping...
<oct 14 18:26:36.262> <DEBUG> <net.sf.ehcache.Cache:949> - No 
BootstrapCacheLoaderFactory class specified. Skipping...
<oct 14 18:26:36.262> <DEBUG> <net.sf.ehcache.Cache:923> - CacheWriter factory 
not configured. Skipping...
<oct 14 18:26:36.262> <DEBUG> <net.sf.ehcache.config.ConfigurationHelper:96> - 
No CacheExceptionHandlerFactory class specified. Skipping...
<oct 14 18:26:36.290> <DEBUG> <net.sf.ehcache.Cache:1183> - Initialised cache: 
commodityCache
<oct 14 18:26:36.290> <DEBUG> <net.sf.ehcache.config.ConfigurationHelper:331> - 
CacheDecoratorFactory not configured. Skipping for 'commodityCache'.
<oct 14 18:26:36.291> <DEBUG> <net.sf.ehcache.config.ConfigurationHelper:360> - 
CacheDecoratorFactory not configured for defaultCache. Skipping for 
'commodityCache'.



What version of the product are you using? On what operating system?

1.2 at windows 7

Please provide any additional information below.
I can provide pom.xml info or whatever else if needed



Is there any way to check out why the interceptor it is not being called?

Original issue reported on code.google.com by [email protected] on 14 Oct 2011 at 9:49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant