Hi Aaron, I'm getting the CacheException while trying to cache an object. Here's the piece of code I've been working with.
import org.apache.jcs.JCS; import org.apache.jcs.access.exception.CacheException; public class Main { /** * @param args */ public static void main(String[] args) { Person mary_ = new Person("MARY"); //Create an instance of the Cache Hnadler JCS cache = null; try{ cache = JCS.getInstance("testCache1"); if(null == cache) {System.out.println("cache= null");} //Insert the objects into the cache if(null == mary_) { System.out.println("the object is null"); } System.out.println("b4 put"); String key = mary_.toString(); System.out.println(key); cache.put(key, mary_); System.out.println("after put"); } catch(CacheException CE) { System.out.println("caught exception "+ CE.getCause()); } if(null != cache) { cache.get(mary_.toString()); } } } class Person { private String name; Person(String str) { name = str; } public String toString() { return name; } } My configuration file is as follows: (no new lines this time) # DEFAULT CACHE REGION jcs.default=DC jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes jcs.default.cacheattributes.MaxObjects=1000 jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache # PRE-DEFINED CACHE REGIONS jcs.region.testCache1=DC jcs.region.testCache1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes jcs.region.testCache1.cacheattributes.MaxObjects=1000 jcs.region.testCache1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache # AVAILABLE AUXILIARY CACHES jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes jcs.auxiliary.DC.attributes.DiskPath=${user.dir} jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000000 jcs.auxiliary.DC.attributes.MaxKeySize=1000000 jcs.auxiliary.DC.attributes.MaxRecycleBinSize=5000 jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000 And.. here's the output: Jun 19, 2006 2:48:34 PM org.apache.jcs.engine.control.CompositeCacheManager configure INFO: Creating cache manager from config file: /cache.ccf Jun 19, 2006 2:48:34 PM org.apache.jcs.utils.threadpool.ThreadPoolManager loadConfig INFO: thread_pool.default PoolConfiguration = useBoundary = [true]boundarySize = [2000]maximumPoolSize = [150]minimumPoolSize = [4]keepAliveTime = [300000]whenBlockedPolicy = [RUN]startUpSize = [4] Jun 19, 2006 2:48:34 PM org.apache.jcs.engine.control.CompositeCacheConfigurator setDefaultAuxValues INFO: Setting default auxiliaries to DC Jun 19, 2006 2:48:34 PM org.apache.jcs.engine.control.CompositeCacheConfigurator setDefaultCompositeCacheAttributes INFO: setting defaultCompositeCacheAttributes to [ useLateral = true, useRemote = true, useDisk = true, maxObjs = 1000, maxSpoolPerRun = -1 ] Jun 19, 2006 2:48:34 PM org.apache.jcs.engine.control.CompositeCacheConfigurator parseElementAttributes INFO: No special ElementAttribute class defined for key [jcs.default.elementattributes], using default class. Jun 19, 2006 2:48:34 PM org.apache.jcs.engine.control.CompositeCacheConfigurator setDefaultElementAttributes INFO: setting defaultElementAttributes to [ IS_LATERAL = true, IS_SPOOL = true, IS_REMOTE = true, IS_ETERNAL = true, MaxLifeSeconds = -1, IdleTime = -1, CreateTime = 1150708714948, LastAccessTime = 1150708714948, getTimeToLiveSeconds() = -1, createTime = 1150708714948 ] Jun 19, 2006 2:48:34 PM org.apache.jcs.engine.control.CompositeCacheConfigurator parseElementAttributes INFO: No special ElementAttribute class defined for key [jcs.region.testCache1.elementattributes], using default class. Jun 19, 2006 2:48:34 PM org.apache.jcs.engine.memory.lru.LRUMemoryCache initialize INFO: initialized LRUMemoryCache for testCache1 Jun 19, 2006 2:48:34 PM org.apache.jcs.engine.control.CompositeCache <init> INFO: Constructed cache with name: testCache1 Jun 19, 2006 2:48:35 PM org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache <init> INFO: Cache file root directory: C:\EclipseForJava\JCSLab Jun 19, 2006 2:48:35 PM org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache initKeyMap INFO: Set maxKeySize to: '1000000' Jun 19, 2006 2:48:35 PM org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache initRecycleBin INFO: Set recycle max Size to MaxRecycleBinSize: '5000' Jun 19, 2006 2:48:35 PM org.apache.jcs.engine.control.CompositeCacheConfigurator parseRegions INFO: Parsed regions [testCache1] Jun 19, 2006 2:48:35 PM org.apache.jcs.engine.control.CompositeCacheConfigurator doConfigure INFO: Finished configuration in 203 ms. b4 put MARY caught exception null Jun 19, 2006 2:48:35 PM org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache$ShutdownHook run INFO: Disk cache was not shutdown properly. Will try to dispose. NOTE: The above program works fine if I cache simple strings but it fails if I use objects as in the above program. Could you help me with this please.. ______________________________________________________________________