net.sf.ehcache.CacheException: Cache: visitorDomain was being used with cache writer features, but it wasn't properly registered beforehand.

Terracotta Project Issue Tracker | Patrice Jaton | 7 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    According to the Javadoc of the new cache's putWithWriter(Element) method: Put an element in the cache writing through a CacheWriter. If no CacheWriter has been set for the cache, then this method has the same effect as cache.put(). However, when using this method without having any cache writer registered, the following exception is thrown. For consistency, it seems that the putWithWriter method should act as documented as this is how the getWithLoader method will behave when no loader is registered with the cache. net.sf.ehcache.CacheException: Cache: visitorDomain was being used with cache writer features, but it wasn't properly registered beforehand. at net.sf.ehcache.Cache.initialiseCacheWriterManager(Cache.java:1033) at net.sf.ehcache.Cache.putInternal(Cache.java:1165) at net.sf.ehcache.Cache.putWithWriter(Cache.java:1160) at com.localmatters.ds.dao.terracotta.ehcache.EhcacheWithWriteBehind.save(EhcacheWithWriteBehind.java:29) at com.localmatters.ds.dao.cache.CacheWithKeyGeneration.save(CacheWithKeyGeneration.java:27) at com.localmatters.ds.dao.cache.CacheWithKeyGeneration.save(CacheWithKeyGeneration.java:14) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:592) at com.localmatters.util.hotswap.HotSwappingInvoker.invoke(HotSwappingInvoker.java:35) at $Proxy37.save(Unknown Source) at com.localmatters.ds.dao.cache.VisitorDaoCache.saveVisitorDomain(VisitorDaoCache.java:196) at com.localmatters.ds.dao.cache.VisitorDaoCache.saveVisitor(VisitorDaoCache.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:592) at com.localmatters.util.hotswap.HotSwappingInvoker.invoke(HotSwappingInvoker.java:35) at $Proxy38.saveVisitor(Unknown Source) at com.localmatters.ds.persistence.DefaultPersistenceControllerImpl.saveVisitor(DefaultPersistenceControllerImpl.java:183) at com.localmatters.ds.service.DefaultVisitorDomainServiceImpl$2.doInTemplate(DefaultVisitorDomainServiceImpl.java:148) at com.localmatters.mvc.domain.DomainTemplate.execute(DomainTemplate.java:48) ... 69 more

    Terracotta Project Issue Tracker | 7 years ago | Patrice Jaton
    net.sf.ehcache.CacheException: Cache: visitorDomain was being used with cache writer features, but it wasn't properly registered beforehand.
  2. 0

    According to the Javadoc of the new cache's putWithWriter(Element) method: Put an element in the cache writing through a CacheWriter. If no CacheWriter has been set for the cache, then this method has the same effect as cache.put(). However, when using this method without having any cache writer registered, the following exception is thrown. For consistency, it seems that the putWithWriter method should act as documented as this is how the getWithLoader method will behave when no loader is registered with the cache. net.sf.ehcache.CacheException: Cache: visitorDomain was being used with cache writer features, but it wasn't properly registered beforehand. at net.sf.ehcache.Cache.initialiseCacheWriterManager(Cache.java:1033) at net.sf.ehcache.Cache.putInternal(Cache.java:1165) at net.sf.ehcache.Cache.putWithWriter(Cache.java:1160) at com.localmatters.ds.dao.terracotta.ehcache.EhcacheWithWriteBehind.save(EhcacheWithWriteBehind.java:29) at com.localmatters.ds.dao.cache.CacheWithKeyGeneration.save(CacheWithKeyGeneration.java:27) at com.localmatters.ds.dao.cache.CacheWithKeyGeneration.save(CacheWithKeyGeneration.java:14) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:592) at com.localmatters.util.hotswap.HotSwappingInvoker.invoke(HotSwappingInvoker.java:35) at $Proxy37.save(Unknown Source) at com.localmatters.ds.dao.cache.VisitorDaoCache.saveVisitorDomain(VisitorDaoCache.java:196) at com.localmatters.ds.dao.cache.VisitorDaoCache.saveVisitor(VisitorDaoCache.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:592) at com.localmatters.util.hotswap.HotSwappingInvoker.invoke(HotSwappingInvoker.java:35) at $Proxy38.saveVisitor(Unknown Source) at com.localmatters.ds.persistence.DefaultPersistenceControllerImpl.saveVisitor(DefaultPersistenceControllerImpl.java:183) at com.localmatters.ds.service.DefaultVisitorDomainServiceImpl$2.doInTemplate(DefaultVisitorDomainServiceImpl.java:148) at com.localmatters.mvc.domain.DomainTemplate.execute(DomainTemplate.java:48) ... 69 more

    Terracotta Project Issue Tracker | 7 years ago | Patrice Jaton
    net.sf.ehcache.CacheException: Cache: visitorDomain was being used with cache writer features, but it wasn't properly registered beforehand.

    Root Cause Analysis

    1. net.sf.ehcache.CacheException

      Cache: visitorDomain was being used with cache writer features, but it wasn't properly registered beforehand.

      at net.sf.ehcache.Cache.initialiseCacheWriterManager()
    2. Ehcache
      Cache.putWithWriter
      1. net.sf.ehcache.Cache.initialiseCacheWriterManager(Cache.java:1033)
      2. net.sf.ehcache.Cache.putInternal(Cache.java:1165)
      3. net.sf.ehcache.Cache.putWithWriter(Cache.java:1160)
      3 frames
    3. com.localmatters.ds
      CacheWithKeyGeneration.save
      1. com.localmatters.ds.dao.terracotta.ehcache.EhcacheWithWriteBehind.save(EhcacheWithWriteBehind.java:29)
      2. com.localmatters.ds.dao.cache.CacheWithKeyGeneration.save(CacheWithKeyGeneration.java:27)
      3. com.localmatters.ds.dao.cache.CacheWithKeyGeneration.save(CacheWithKeyGeneration.java:14)
      3 frames
    4. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:592)
      4 frames
    5. com.localmatters.util
      HotSwappingInvoker.invoke
      1. com.localmatters.util.hotswap.HotSwappingInvoker.invoke(HotSwappingInvoker.java:35)
      1 frame
    6. Unknown
      $Proxy37.save
      1. $Proxy37.save(Unknown Source)
      1 frame
    7. com.localmatters.ds
      VisitorDaoCache.saveVisitor
      1. com.localmatters.ds.dao.cache.VisitorDaoCache.saveVisitorDomain(VisitorDaoCache.java:196)
      2. com.localmatters.ds.dao.cache.VisitorDaoCache.saveVisitor(VisitorDaoCache.java:179)
      2 frames
    8. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:592)
      4 frames
    9. com.localmatters.util
      HotSwappingInvoker.invoke
      1. com.localmatters.util.hotswap.HotSwappingInvoker.invoke(HotSwappingInvoker.java:35)
      1 frame
    10. Unknown
      $Proxy38.saveVisitor
      1. $Proxy38.saveVisitor(Unknown Source)
      1 frame
    11. com.localmatters.ds
      DefaultVisitorDomainServiceImpl$2.doInTemplate
      1. com.localmatters.ds.persistence.DefaultPersistenceControllerImpl.saveVisitor(DefaultPersistenceControllerImpl.java:183)
      2. com.localmatters.ds.service.DefaultVisitorDomainServiceImpl$2.doInTemplate(DefaultVisitorDomainServiceImpl.java:148)
      2 frames
    12. com.localmatters.mvc
      DomainTemplate.execute
      1. com.localmatters.mvc.domain.DomainTemplate.execute(DomainTemplate.java:48)
      1 frame