dcsimg
Object Caching Error with CacheException
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Cathy_Haro
Posted On:   Friday, January 9, 2004 07:35 AM

Hi! I am trying to use the Object Caching Service of Oracle (OCS4J) to cache objects. I was able to create a loader which extends the CacheLoader and a class which accesses the object cache. My problem is when I call this class in my serlvet, I get the error java.lang.NoClassDefFound:oracle.ias.CacheException I would really appreciate help on this matter since there are not so many articles/source about this OCS4J API.Following are my codes. thanks, Cathy My CacheLoader object is package no.ssb.util.cache; import oracle.ias.cache.*; public class ObjectCacheLoader extends CacheLoader { public ObjectCacheLoader() { } public Object load(Object handle, Object args)   More>>

Hi!
I am trying to use the Object Caching Service of Oracle (OCS4J) to cache objects. I was able to create a loader which extends the CacheLoader and a class which accesses the object cache. My problem is when I call this class in my serlvet, I get the error java.lang.NoClassDefFound:oracle.ias.CacheException


I would really appreciate help on this matter since there are not so many articles/source about this OCS4J API.Following are my codes. thanks, Cathy



My CacheLoader object is



package no.ssb.util.cache;



import oracle.ias.cache.*;


public class ObjectCacheLoader extends CacheLoader {



public ObjectCacheLoader() {


}



public Object load(Object handle, Object args) {


String testcontents=null;


try{


testcontents = expensiveCall(args);


}catch (Exception ex) {}


return new String(testcontents);


}



private String expensiveCall(Object args){


String str=null;


str="testdata";


return str;


}



}



The class which accesses the cached object


package no.ssb.util.cache;


import oracle.ias.cache.*;


import no.ssb.util.cache.ObjectCacheLoader;


import no.ssb.util.log.ServerLog;



public class ObjectCacheMgr {


public static final String APP_NAME = "SCHEMADEF";



public static String getCacheObj() {


String obj=null;


ObjectCacheLoader objLoader= new ObjectCacheLoader();


CacheAccess caccess=null;


Attributes attr = new Attributes();


try{


attr.setLoader(objLoader);


attr.setIdleTime(120);



CacheAccess.defineRegion

(APP_NAME,attr); //define a region and its attribute

caccess=CacheAccess.getAccess(APP_NAME); //request for access to a cache region


caccess.defineObject("TestObject",attr);



//object is loaded using the loader ObjectCacheLoader, defined on the region,


//if the object is not yet in the cache



obj = (String) caccess.get("TestObject");


}catch (CacheException ex ){


ServerLog.putErr("Caching error", ex.toString(),"");


}finally {


if (caccess!=null)


caccess.close();


}


return obj;


}


}

   <<Less
About | Sitemap | Contact