Return-Path: Delivered-To: apmail-jakarta-jcs-users-archive@www.apache.org Received: (qmail 66976 invoked from network); 19 Jun 2006 09:29:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Jun 2006 09:29:54 -0000 Received: (qmail 50912 invoked by uid 500); 19 Jun 2006 09:29:53 -0000 Delivered-To: apmail-jakarta-jcs-users-archive@jakarta.apache.org Received: (qmail 50897 invoked by uid 500); 19 Jun 2006 09:29:52 -0000 Mailing-List: contact jcs-users-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "JCS Users List" Delivered-To: mailing list jcs-users@jakarta.apache.org Received: (qmail 50886 invoked by uid 99); 19 Jun 2006 09:29:52 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Jun 2006 02:29:52 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [194.106.220.35] (HELO mail91.messagelabs.com) (194.106.220.35) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 19 Jun 2006 02:29:50 -0700 X-VirusChecked: Checked X-Env-Sender: Simon.Horton@uk.mizuho-sc.com X-Msg-Ref: server-8.tower-91.messagelabs.com!1150709368!18433679!1 X-StarScan-Version: 5.5.10.7; banners=-,-,- X-Originating-IP: [195.47.198.136] Received: (qmail 5706 invoked from network); 19 Jun 2006 09:29:28 -0000 Received: from unknown (HELO maimsbra1.uk.mizuho-sc.com) (195.47.198.136) by server-8.tower-91.messagelabs.com with SMTP; 19 Jun 2006 09:29:28 -0000 Received: from gbr2-ldn05.uk.mizuho-sc.com (unverified) by maimsbra1.uk.mizuho-sc.com (Clearswift SMTPRS 5.1.7) with ESMTP id for ; Mon, 19 Jun 2006 10:29:11 +0100 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 Subject: RE: Problem getting JCS to work Date: Mon, 19 Jun 2006 10:29:13 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Problem getting JCS to work Thread-Index: AcaTgdVBewMB/0ymShqo3Vt70jeSjQAAMtgw From: "Horton Simon" To: "JCS Users List" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, Try changing your Person class so that it implements Serializable. Regards, Simon -----Original Message----- From: Sreelakshmi Dokkara [mailto:Sreelakshmi.Dokkara@lntinfotech.com]=20 Sent: Monday, June 19, 2006 10:26 AM To: jcs-users@jakarta.apache.org Subject: Problem getting JCS to work Hi Aaron, I'm getting the CacheException while trying to cache an object.=20 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) { =20 Person mary_ =3D new Person("MARY"); =20 //Create an instance of the Cache Hnadler JCS cache =3D null; try{ cache =3D JCS.getInstance("testCache1"); if(null =3D=3D cache) {System.out.println("cache=3D null");} //Insert the objects into the cache if(null =3D=3D mary_) { System.out.println("the object is null"); } System.out.println("b4 put");=20 String key =3D 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 !=3D cache) { cache.get(mary_.toString());=20 } } } class Person { private String name; Person(String str) { name =3D str; } =20 public String toString() { return name; } } My configuration file is as follows: (no new lines this time) # DEFAULT CACHE REGION=20 jcs.default=3DDC jcs.default.cacheattributes=3Dorg.apache.jcs.engine.CompositeCacheAttribut es jcs.default.cacheattributes.MaxObjects=3D1000 jcs.default.cacheattributes.MemoryCacheName=3Dorg.apache.jcs.engine.memory .lru.LRUMemoryCache # PRE-DEFINED CACHE REGIONS=20 jcs.region.testCache1=3DDC jcs.region.testCache1.cacheattributes=3Dorg.apache.jcs.engine.CompositeCac heAttributes jcs.region.testCache1.cacheattributes.MaxObjects=3D1000 jcs.region.testCache1.cacheattributes.MemoryCacheName=3Dorg.apache.jcs.eng ine.memory.lru.LRUMemoryCache # AVAILABLE AUXILIARY CACHES=20 jcs.auxiliary.DC=3Dorg.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheF actory jcs.auxiliary.DC.attributes=3Dorg.apache.jcs.auxiliary.disk.indexed.Indexe dDiskCacheAttributes jcs.auxiliary.DC.attributes.DiskPath=3D${user.dir} jcs.auxiliary.DC.attributes.MaxPurgatorySize=3D10000000 jcs.auxiliary.DC.attributes.MaxKeySize=3D1000000 jcs.auxiliary.DC.attributes.MaxRecycleBinSize=3D5000 jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=3D300000 And.. here's the output: Jun 19, 2006 2:48:34 PM=20 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=20 loadConfig INFO: thread_pool.default PoolConfiguration =3D useBoundary =3D=20 [true]boundarySize =3D [2000]maximumPoolSize =3D [150]minimumPoolSize =3D= =20 [4]keepAliveTime =3D [300000]whenBlockedPolicy =3D [RUN]startUpSize =3D [4] Jun 19, 2006 2:48:34 PM=20 org.apache.jcs.engine.control.CompositeCacheConfigurator=20 setDefaultAuxValues INFO: Setting default auxiliaries to DC Jun 19, 2006 2:48:34 PM=20 org.apache.jcs.engine.control.CompositeCacheConfigurator=20 setDefaultCompositeCacheAttributes INFO: setting defaultCompositeCacheAttributes to [ useLateral =3D true,=20 useRemote =3D true, useDisk =3D true, maxObjs =3D 1000, maxSpoolPerRun =3D = -1 ] Jun 19, 2006 2:48:34 PM=20 org.apache.jcs.engine.control.CompositeCacheConfigurator=20 parseElementAttributes INFO: No special ElementAttribute class defined for key=20 [jcs.default.elementattributes], using default class. Jun 19, 2006 2:48:34 PM=20 org.apache.jcs.engine.control.CompositeCacheConfigurator=20 setDefaultElementAttributes INFO: setting defaultElementAttributes to [ IS_LATERAL =3D true, IS_SPOOL =3D=20 true, IS_REMOTE =3D true, IS_ETERNAL =3D true, MaxLifeSeconds =3D -1, IdleT= ime =3D=20 -1, CreateTime =3D 1150708714948, LastAccessTime =3D 1150708714948,=20 getTimeToLiveSeconds() =3D -1, createTime =3D 1150708714948 ] Jun 19, 2006 2:48:34 PM=20 org.apache.jcs.engine.control.CompositeCacheConfigurator=20 parseElementAttributes INFO: No special ElementAttribute class defined for key=20 [jcs.region.testCache1.elementattributes], using default class. Jun 19, 2006 2:48:34 PM org.apache.jcs.engine.memory.lru.LRUMemoryCache=20 initialize INFO: initialized LRUMemoryCache for testCache1 Jun 19, 2006 2:48:34 PM org.apache.jcs.engine.control.CompositeCache=20 INFO: Constructed cache with name: testCache1 Jun 19, 2006 2:48:35 PM=20 org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache INFO: Cache file root directory: C:\EclipseForJava\JCSLab Jun 19, 2006 2:48:35 PM=20 org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache initKeyMap INFO: Set maxKeySize to: '1000000' Jun 19, 2006 2:48:35 PM=20 org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache initRecycleBin INFO: Set recycle max Size to MaxRecycleBinSize: '5000' Jun 19, 2006 2:48:35 PM=20 org.apache.jcs.engine.control.CompositeCacheConfigurator parseRegions INFO: Parsed regions [testCache1] Jun 19, 2006 2:48:35 PM=20 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=20 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=20 if I use objects as in the above program. Could you help me with this please.. ______________________________________________________________________ This message and any files transmitted with it are confidential and intende= d solely for the use of the individual or entity to whom they are addressed= . If you have received this message in error please delete it and any files= transmitted with it, after notifying postmaster@uk.mizuho-sc.com=20 Any opinions expressed in this message may be those of the author and not n= ecessarily those of the company. The company accepts no responsibility for = the accuracy or completeness of any information contained herein. This mess= age is not intended to create legal relations between the company and the r= ecipient.=20 Recipients should please note that messages sent via the Internet may be in= tercepted and that caution should therefore be exercised before dispatching= to the company any confidential or sensitive information.=20 Mizuho International plc Bracken House, One Friday Street, London EC4M 9JA.= TEL. 020 72361090. Wholly owned subsidiary of Mizuho Securities Co., Ltd. = Member of Mizuho Financial Group. Authorised and regulated by the Financial= Services Authority. Member of the London Stock Exchange.=20 Registered in England No. 1203696. Registered office as above. --------------------------------------------------------------------- To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org For additional commands, e-mail: jcs-users-help@jakarta.apache.org