• Bug
  • Status: Closed
  • Resolution: Fixed
  • drb
  • Reporter: sourceforgetracker
  • September 21, 2009
  • 0
  • Watchers: 0
  • September 22, 2009
  • September 22, 2009

Description

Hello.

Overflow of my cache elements are dumped on a disk. But when ehcache tries to get them back I’ve got ClassNotFoundException for every dumped element:

18:21:48,439 [ERROR] TP-Processor1: ContentCache: Could not read disk store element for key CacheKey(phone=Phone()). Error was com.Phone java.lang.ClassNotFoundException: com.Phone at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1355) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1201) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:242) at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:585) at net.sf.ehcache.store.DiskStore$1.resolveClass(DiskStore.java:297) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1544) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348) at java.util.HashMap.readObject(HashMap.java:1067) at sun.reflect.GeneratedMethodAccessor82.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1809) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348) at net.sf.ehcache.store.DiskStore.loadElementFromDiskElement(DiskStore.java:301) at net.sf.ehcache.store.DiskStore.get(DiskStore.java:256) at net.sf.ehcache.Cache.searchInDiskStore(Cache.java:1176) at net.sf.ehcache.Cache.get(Cache.java:781) at net.sf.ehcache.Cache.get(Cache.java:755) at …

All the elements being cached and their classes are retrieved via RMI hence the classes are cached by RMIClassLoader.

When ehcache’s DiskStore tries to resolve class it uses Class.forName() routine the behavior of which is quite wrong (according to this http://blog.bjhargrave.com/2007/09/classforname-caches-defined-class-in.html investigation).

Would using of ClassLoader.loadClass() routine solve the issue? Is there another workaround of it?

I’d be very appreciated for any help or advice.

Andrey. Sourceforge Ticket ID: 2203806 - Opened By: andrey__ch - 28 Oct 2008 11:23 UTC

Comments

Sourceforge Tracker 2009-09-21

This is the only report of this.

What version of Ehcache are you using?

There have been a few fixes to this few the versions. Comment by: gregluck - 4 Apr 2009 07:28 UTC

Fiona OShea 2009-09-22

Re-opening so that I can properly close out these issues and have correct Resolution status in Jira