jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From saipradee...@tcs.com
Subject Simple JCS program
Date Thu, 30 Jun 2005 11:10:16 GMT

Hi all,

I am new to JCS. I have written a simple JCS program as per the guidelines 

i got from the documentation. But I am not able to successfully execute 
it. I am enclosing my program and the exception which I have received for 
your perusal. please do suggest.

Cheers
Saipradeep V.G.


CacheController.java


import java.util.List;
import org.apache.jcs.JCS;

public class CacheController {
 
        private static JCS viewCache;
        private static CacheController cacheinstance=null;
 
        private CacheController()
        {
                try
                {
                        viewCache = JCS.getInstance("viewCache");
                }
                catch (Exception e){e.printStackTrace();}
        }
 
        public static CacheController getInstance()
        {
                synchronized(CacheController.class)
                {
                        if(cacheinstance==null)
                        {
                                cacheinstance = new CacheController();
                        }
                }
                return cacheinstance;
        }
 
        public static JCS getCurrentInstance()
        {
                return viewCache;
        }
 
 
        public List getComponentData(cachekey) throws Exception
        {
                List compdata = searchViewCache(cachekey);
                return compdata;
        }
 
        public void setComponentData(List compData, String cachekey) 
throws Exception
        {
                updateViewCache(compData,cachekey);
        }
 
        private List searchViewCache(String cachekey)
        {
                List compdata = null;
                try
                {
                        System.out.println("Searching for CacheKey 
["+cachekey);
                        Object obj =  viewCache.get(cachekey);
                        System.out.println(obj.toString());
                }catch(Exception e){e.printStackTrace();}
                return compdata;
        }

        public  void updateViewCache(List compData, String cachekey) 
throws Exception
        {
                try{
                        viewCache.put(cachekey,compData);
                }catch(Exception e){e.printStackTrace();}
        }
 

}

Exception

log4j:WARN No appenders could be found for logger 
(org.apache.jcs.engine.control.CompositeCacheManager).
log4j:WARN Please initialize the log4j system properly.
java.lang.NoClassDefFoundError: EDU/oswego/cs/dl/util/concurrent/Channel
        at 
org.apache.jcs.engine.control.CompositeCacheManager.configure(CompositeCacheManager.java:203)
        at 
org.apache.jcs.engine.control.CompositeCacheManager.configure(CompositeCacheManager.java:192)
        at 
org.apache.jcs.engine.control.CompositeCacheManager.configure(CompositeCacheManager.java:149)
        at 
org.apache.jcs.engine.control.CompositeCacheManager.getInstance(CompositeCacheManager.java:93)
        at org.apache.jcs.JCS.ensureCacheManager(JCS.java:99)
        at org.apache.jcs.JCS.getInstance(JCS.java:64)
        at 
com.bofa.crme.grp.view.CacheController.<init>(CacheController.java:31)
        at 
com.bofa.crme.grp.view.CacheController.getInstance(CacheController.java:43)
        at TestViewCache.main(TestViewCache.java:28)
Exception in thread "main" 



Notice: The information contained in this e-mail message and/or attachments to it may contain
confidential or privileged information.   If you are not the intended recipient, any dissemination,
use, review, distribution, printing or copying of the information contained in this e-mail
message and/or attachments to it are strictly prohibited.   If you have received this communication
in error, please notify us by reply e-mail or telephone and immediately and permanently delete
the message and any attachments.  Thank you
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message