net.sf.ehcache.CacheException: The key java.lang.Object@45d6a56e is not Serializable. Consider using Element.getObjectKey()

Terracotta Project Issue Tracker | Jeferson Estevo | 2 years ago
  1. 0

    Hello, While trying to put a non serializable key to the Cache.put method, in ehcache-core 2.6.10, we get the following exception: net.sf.ehcache.CacheException: The key java.lang.Object@45d6a56e is not Serializable. Consider using Element.getObjectKey() at net.sf.ehcache.Element.getKey(Element.java:256) at net.sf.ehcache.store.MemoryStore.evict(MemoryStore.java:853) at net.sf.ehcache.store.NotifyingMemoryStore.evict(NotifyingMemoryStore.java:60) at net.sf.ehcache.store.MemoryStore.removeElementChosenByEvictionPolicy(MemoryStore.java:596) at net.sf.ehcache.store.MemoryStore.checkCapacity(MemoryStore.java:562) at net.sf.ehcache.store.MemoryStore.put(MemoryStore.java:262) at net.sf.ehcache.store.FrontEndCacheTier.put(FrontEndCacheTier.java:267) at net.sf.ehcache.Cache.putInternal(Cache.java:1455) at net.sf.ehcache.Cache.put(Cache.java:1383) at net.sf.ehcache.Cache.put(Cache.java:1348) In version 2.6.9 it was working fine. Apparently this started happening after a change in the "NotifyingMemoryStore.evict" method in version 2.6.10. We've created this unit test so you can reproduce the scenario: @Test public void testCacheWithNonSerializableKey() { Cache cache = new Cache("test", 100, false, true, 9000, 9000, false, 900); cache.setCacheManager(new CacheManager()); cache.initialise(); cache.getCacheConfiguration().setMaxEntriesLocalHeap(1L); cache.setMemoryStoreEvictionPolicy(new LruPolicy()); for (int i = 0; i < 2; i++) { Element element = new Element(new Object(), "result"); cache.put(element); } }

    Terracotta Project Issue Tracker | 2 years ago | Jeferson Estevo
    net.sf.ehcache.CacheException: The key java.lang.Object@45d6a56e is not Serializable. Consider using Element.getObjectKey()
  2. 0

    Hello, While trying to put a non serializable key to the Cache.put method, in ehcache-core 2.6.10, we get the following exception: net.sf.ehcache.CacheException: The key java.lang.Object@45d6a56e is not Serializable. Consider using Element.getObjectKey() at net.sf.ehcache.Element.getKey(Element.java:256) at net.sf.ehcache.store.MemoryStore.evict(MemoryStore.java:853) at net.sf.ehcache.store.NotifyingMemoryStore.evict(NotifyingMemoryStore.java:60) at net.sf.ehcache.store.MemoryStore.removeElementChosenByEvictionPolicy(MemoryStore.java:596) at net.sf.ehcache.store.MemoryStore.checkCapacity(MemoryStore.java:562) at net.sf.ehcache.store.MemoryStore.put(MemoryStore.java:262) at net.sf.ehcache.store.FrontEndCacheTier.put(FrontEndCacheTier.java:267) at net.sf.ehcache.Cache.putInternal(Cache.java:1455) at net.sf.ehcache.Cache.put(Cache.java:1383) at net.sf.ehcache.Cache.put(Cache.java:1348) In version 2.6.9 it was working fine. Apparently this started happening after a change in the "NotifyingMemoryStore.evict" method in version 2.6.10. We've created this unit test so you can reproduce the scenario: @Test public void testCacheWithNonSerializableKey() { Cache cache = new Cache("test", 100, false, true, 9000, 9000, false, 900); cache.setCacheManager(new CacheManager()); cache.initialise(); cache.getCacheConfiguration().setMaxEntriesLocalHeap(1L); cache.setMemoryStoreEvictionPolicy(new LruPolicy()); for (int i = 0; i < 2; i++) { Element element = new Element(new Object(), "result"); cache.put(element); } }

    Terracotta Project Issue Tracker | 2 years ago | Jeferson Estevo
    net.sf.ehcache.CacheException: The key java.lang.Object@45d6a56e is not Serializable. Consider using Element.getObjectKey()
  3. 0

    UpdatingSelfPopulatingCache fails to call updateEntryValue( ) because it expects replacementElement.getValue() to return a class that implements Serializable interface. Specially the following line in SelfPopulatingCache.refreshElement( ) is skipped ((UpdatingCacheEntryFactory) factory).updateEntryValue(key, replacementElement.getValue()); Here is snip of the stack trace: net.sf.ehcache.CacheException: The value com.digitalimpact.catalog.assembler.cellcache.CachedCell@1a62c31 for key com.digitalimpact.catalog.assembler.cellcache.CacheKey@5c957 is not Serializable. Consider using Element#getObjectKey() at net.sf.ehcache.Element.getValue(Element.java:244) at net.sf.ehcache.constructs.blocking.SelfPopulatingCache.refreshElement(SelfPopulatingCache.java:183) at net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache.update(UpdatingSelfPopulatingCache.java:108) at net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache.get(UpdatingSelfPopulatingCache.java:79) Work around at the mement is to make 'value' class implement Serializable interface, but not sure if that is the original intention (requirement) for updating value of elements. Sourceforge Ticket ID: 2790350 - Opened By: k719 - 11 May 2009 23:02 UTC

    Terracotta Project Issue Tracker | 7 years ago | Sourceforge Tracker
    net.sf.ehcache.CacheException: The value com.digitalimpact.catalog.assembler.cellcache.CachedCell@1a62c31 for key com.digitalimpact.catalog.assembler.cellcache.CacheKey@5c957 is not Serializable. Consider using Element#getObjectKey()
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    UpdatingSelfPopulatingCache fails to call updateEntryValue( ) because it expects replacementElement.getValue() to return a class that implements Serializable interface. Specially the following line in SelfPopulatingCache.refreshElement( ) is skipped ((UpdatingCacheEntryFactory) factory).updateEntryValue(key, replacementElement.getValue()); Here is snip of the stack trace: net.sf.ehcache.CacheException: The value com.digitalimpact.catalog.assembler.cellcache.CachedCell@1a62c31 for key com.digitalimpact.catalog.assembler.cellcache.CacheKey@5c957 is not Serializable. Consider using Element#getObjectKey() at net.sf.ehcache.Element.getValue(Element.java:244) at net.sf.ehcache.constructs.blocking.SelfPopulatingCache.refreshElement(SelfPopulatingCache.java:183) at net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache.update(UpdatingSelfPopulatingCache.java:108) at net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache.get(UpdatingSelfPopulatingCache.java:79) Work around at the mement is to make 'value' class implement Serializable interface, but not sure if that is the original intention (requirement) for updating value of elements. Sourceforge Ticket ID: 2790350 - Opened By: k719 - 11 May 2009 23:02 UTC

    Terracotta Project Issue Tracker | 7 years ago | Sourceforge Tracker
    net.sf.ehcache.CacheException: The value com.digitalimpact.catalog.assembler.cellcache.CachedCell@1a62c31 for key com.digitalimpact.catalog.assembler.cellcache.CacheKey@5c957 is not Serializable. Consider using Element#getObjectKey()
  6. 0

    File upload error - ehcache (Roller 4.1, GF 3.1)

    roller-user | 4 years ago | Simon Haslam
    net.sf.ehcache.CacheException: userCache Cache: The Disk store is not active.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. net.sf.ehcache.CacheException

      The key java.lang.Object@45d6a56e is not Serializable. Consider using Element.getObjectKey()

      at net.sf.ehcache.Element.getKey()
    2. Ehcache
      Cache.put
      1. net.sf.ehcache.Element.getKey(Element.java:256)
      2. net.sf.ehcache.store.MemoryStore.evict(MemoryStore.java:853)
      3. net.sf.ehcache.store.NotifyingMemoryStore.evict(NotifyingMemoryStore.java:60)
      4. net.sf.ehcache.store.MemoryStore.removeElementChosenByEvictionPolicy(MemoryStore.java:596)
      5. net.sf.ehcache.store.MemoryStore.checkCapacity(MemoryStore.java:562)
      6. net.sf.ehcache.store.MemoryStore.put(MemoryStore.java:262)
      7. net.sf.ehcache.store.FrontEndCacheTier.put(FrontEndCacheTier.java:267)
      8. net.sf.ehcache.Cache.putInternal(Cache.java:1455)
      9. net.sf.ehcache.Cache.put(Cache.java:1383)
      10. net.sf.ehcache.Cache.put(Cache.java:1348)
      10 frames