jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sreelakshmi Dokkara <Sreelakshmi.Dokk...@lntinfotech.com>
Subject Problem getting JCS to work
Date Fri, 16 Jun 2006 11:53:29 GMT
--> I have the class  "org.apache.jcs.config.OptionConverter"  which has 
the method instantiateByClassName(String, Class Object).

--> Here are the classes that I'm using to implement JCS (I haven't 
included the POJO fiels. They are simple classes with getters & setters 
for their members).

import org.apache.jcs.JCS;
import org.apache.jcs.access.exception.CacheException;

class Cacher
{
        private JCS cacheHandler = null;
        private String region;

        Cacher(String cacheRegion)
        {
                this.setRegion(cacheRegion);
                try
                {
 this.setCacheHandler(JCS.getInstance(this.getRegion()));
                }
                catch(CacheException ce)
                {
                        System.out.println("Couldn't return reference to 
cache region "+this.getRegion());
                }
        }
 
        public boolean putObject(Object obj)
        {
                if(obj == null)
                {
                        System.out.println("NULL object reference 
passed");
                        return false;
                }
                else
                {
                        try{
                                this.getCacheHandler().put(obj.toString(), 
obj);
                                return true;
                        }
                        catch(CacheException ce)
                        {
                                System.out.println(ce);
                                return false;
                        }
                }
        }
 
        public Object getObject(String key)
        {
                return this.getCacheHandler().get(key);
        }
 
        private JCS getCacheHandler() {
                return cacheHandler;
        }
        private void setCacheHandler(JCS cacheHandler) {
                this.cacheHandler = cacheHandler;
        }
        private String getRegion() {
                return region;
        }
        private void setRegion(String region) {
                this.region = region;
        }
}

public class Main {

        /**
         * @param args
         */
        public static void main(String[] args) {
 
                //Create new objects to be cached
              Student mary_ = new Student();
              mary_.setName("Mary Smith");
 
              Address address = new Address();
              address.setStreet("456 Oak Drive");
              address.setCity("Pleasantville, CA");
              address.setZip(94555);
 
              mary_.setAddress(address);
 
 
              Student joe_ = new Student();
              joe_.setName("Joe Smith");
              joe_.setSchool("Engineering");
 
              // Mary and Joe have the same address 
              joe_.setAddress(address);
 
              Course foo_ = new Course();
              foo_.setTitle("Intro to Foo");
              foo_.setInstructor("Jones");
 
              joe_.addCourse(foo_);
              mary_.addCourse(foo_);
 
              Course bar_ = new Course();
              bar_.setTitle("Advanced Bar");
              bar_.setInstructor("Woods");
              bar_.setRoom("104 Encina");
 
              //Create an instance of the Cache Hnadler
              Cacher cache = new Cacher("ABCache");
 
              //Insert the objects into the cache
              if(cache.putObject(mary_))
              {
                  System.out.println("Caching Successful for "+mary_);
              }
              else
                  System.out.println("Caching Unsuccessful for "+mary_);
 
              if(cache.putObject(joe_))
              {
                  System.out.println("Caching Successful for "+joe_);
              }
              else
                  System.out.println("Caching Unsuccessful for "+joe_);
 
        }

}


Here's the exception which is occuring.

Jun 16, 2006 4:41:48 PM 
org.apache.jcs.engine.control.CompositeCacheManager configure
INFO: Creating cache manager from config file: /cache.ccf
Jun 16, 2006 4:41:49 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 16, 2006 4:41:49 PM 
org.apache.jcs.engine.control.CompositeCacheConfigurator 
setDefaultAuxValues
INFO: Setting default auxiliaries to DC
Jun 16, 2006 4:41:50 PM org.apache.jcs.config.OptionConverter 
instantiateByClassName
SEVERE: Could not instantiate class []
java.lang.ClassNotFoundException: 
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at org.apache.jcs.config.OptionConverter.instantiateByClassName(
OptionConverter.java:327)
        at org.apache.jcs.config.OptionConverter.instantiateByKey(
OptionConverter.java:177)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.parseCompositeCacheAttributes(
CompositeCacheConfigurator.java:389)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.setDefaultCompositeCacheAttributes(
CompositeCacheConfigurator.java:169)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.doConfigure(
CompositeCacheConfigurator.java:127)
        at org.apache.jcs.engine.control.CompositeCacheManager.configure(
CompositeCacheManager.java:311)
        at org.apache.jcs.engine.control.CompositeCacheManager.configure(
CompositeCacheManager.java:255)
        at org.apache.jcs.engine.control.CompositeCacheManager.configure(
CompositeCacheManager.java:242)
        at org.apache.jcs.engine.control.CompositeCacheManager.configure(
CompositeCacheManager.java:191)
        at 
org.apache.jcs.engine.control.CompositeCacheManager.getInstance(
CompositeCacheManager.java:119)
        at org.apache.jcs.JCS.ensureCacheManager(JCS.java:99)
        at org.apache.jcs.JCS.getInstance(JCS.java:64)
        at com.thales.src.Cacher.<init>(Cacher.java:16)
        at com.thales.src.Main.main(Main.java:43)
Jun 16, 2006 4:41:50 PM 
org.apache.jcs.engine.control.CompositeCacheConfigurator 
parseCompositeCacheAttributes
INFO: No special CompositeCacheAttributes class defined for key 
[jcs.default.cacheattributes], using default class.
Jun 16, 2006 4:41:50 PM 
org.apache.jcs.engine.control.CompositeCacheConfigurator 
setDefaultCompositeCacheAttributes
INFO: setting defaultCompositeCacheAttributes to [ useLateral = true, 
useRemote = true, useDisk = true, maxObjs = 1000, maxSpoolPerRun = -1 ]
Jun 16, 2006 4:41:50 PM 
org.apache.jcs.engine.control.CompositeCacheConfigurator 
setDefaultElementAttributes
INFO: setting defaultElementAttributes to [ IS_LATERAL = true, IS_SPOOL = 
true, IS_REMOTE = true, IS_ETERNAL = false, MaxLifeSeconds = 21600, 
IdleTime = 1800, CreateTime = 1150456310867, LastAccessTime = 
1150456310867, getTimeToLiveSeconds() = 21600, createTime = 1150456310867 
]
Jun 16, 2006 4:41:50 PM org.apache.jcs.config.OptionConverter 
instantiateByClassName
SEVERE: Could not instantiate class []
java.lang.ClassNotFoundException: 
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at org.apache.jcs.config.OptionConverter.instantiateByClassName(
OptionConverter.java:327)
        at org.apache.jcs.config.OptionConverter.instantiateByKey(
OptionConverter.java:177)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.parseCompositeCacheAttributes(
CompositeCacheConfigurator.java:389)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(
CompositeCacheConfigurator.java:301)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(
CompositeCacheConfigurator.java:264)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegions(
CompositeCacheConfigurator.java:241)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.doConfigure(
CompositeCacheConfigurator.java:136)
        at org.apache.jcs.engine.control.CompositeCacheManager.configure(
CompositeCacheManager.java:311)
        at org.apache.jcs.engine.control.CompositeCacheManager.configure(
CompositeCacheManager.java:255)
        at org.apache.jcs.engine.control.CompositeCacheManager.configure(
CompositeCacheManager.java:242)
        at org.apache.jcs.engine.control.CompositeCacheManager.configure(
CompositeCacheManager.java:191)
        at 
org.apache.jcs.engine.control.CompositeCacheManager.getInstance(
CompositeCacheManager.java:119)
        at org.apache.jcs.JCS.ensureCacheManager(JCS.java:99)
        at org.apache.jcs.JCS.getInstance(JCS.java:64)
        at com.thales.src.Cacher.<init>(Cacher.java:16)
        at com.thales.src.Main.main(Main.java:43)
Jun 16, 2006 4:41:50 PM 
org.apache.jcs.engine.control.CompositeCacheConfigurator 
parseCompositeCacheAttributes
INFO: No special CompositeCacheAttributes class defined for key 
[jcs.region.ABCache.cacheattributes], using default class.
Jun 16, 2006 4:41:50 PM 
org.apache.jcs.engine.control.CompositeCacheConfigurator 
parseElementAttributes
INFO: No special ElementAttribute class defined for key 
[jcs.region.ABCache.elementattributes], using default class.
Jun 16, 2006 4:41:50 PM org.apache.jcs.engine.control.CompositeCache 
createMemoryCache
WARNING: Failed to init mem cache, using: LRUMemoryCache
java.lang.ClassNotFoundException: 
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at org.apache.jcs.engine.control.CompositeCache.createMemoryCache(
CompositeCache.java:1176)
        at org.apache.jcs.engine.control.CompositeCache.<init>(
CompositeCache.java:138)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(
CompositeCacheConfigurator.java:306)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(
CompositeCacheConfigurator.java:264)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegions(
CompositeCacheConfigurator.java:241)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.doConfigure(
CompositeCacheConfigurator.java:136)
        at org.apache.jcs.engine.control.CompositeCacheManager.configure(
CompositeCacheManager.java:311)
        at org.apache.jcs.engine.control.CompositeCacheManager.configure(
CompositeCacheManager.java:255)
        at org.apache.jcs.engine.control.CompositeCacheManager.configure(
CompositeCacheManager.java:242)
        at org.apache.jcs.engine.control.CompositeCacheManager.configure(
CompositeCacheManager.java:191)
        at 
org.apache.jcs.engine.control.CompositeCacheManager.getInstance(
CompositeCacheManager.java:119)
        at org.apache.jcs.JCS.ensureCacheManager(JCS.java:99)
        at org.apache.jcs.JCS.getInstance(JCS.java:64)
        at com.thales.src.Cacher.<init>(Cacher.java:16)
        at com.thales.src.Main.main(Main.java:43)
Jun 16, 2006 4:41:50 PM org.apache.jcs.engine.memory.lru.LRUMemoryCache 
initialize
INFO: initialized LRUMemoryCache for ABCache
Jun 16, 2006 4:41:50 PM org.apache.jcs.engine.control.CompositeCache 
<init>
INFO: Constructed cache with name: ABCache
Jun 16, 2006 4:41:50 PM org.apache.jcs.config.OptionConverter 
instantiateByClassName
SEVERE: Could not instantiate class []
java.lang.ClassNotFoundException: 
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at org.apache.jcs.config.OptionConverter.instantiateByClassName(
OptionConverter.java:327)
        at org.apache.jcs.config.OptionConverter.instantiateByKey(
OptionConverter.java:177)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.parseAuxiliary(
CompositeCacheConfigurator.java:499)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(
CompositeCacheConfigurator.java:343)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(
CompositeCacheConfigurator.java:264)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegions(
CompositeCacheConfigurator.java:241)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.doConfigure(
CompositeCacheConfigurator.java:136)
        at org.apache.jcs.engine.control.CompositeCacheManager.configure(
CompositeCacheManager.java:311)
        at org.apache.jcs.engine.control.CompositeCacheManager.configure(
CompositeCacheManager.java:255)
        at org.apache.jcs.engine.control.CompositeCacheManager.configure(
CompositeCacheManager.java:242)
        at org.apache.jcs.engine.control.CompositeCacheManager.configure(
CompositeCacheManager.java:191)
        at 
org.apache.jcs.engine.control.CompositeCacheManager.getInstance(
CompositeCacheManager.java:119)
        at org.apache.jcs.JCS.ensureCacheManager(JCS.java:99)
        at org.apache.jcs.JCS.getInstance(JCS.java:64)
        at com.thales.src.Cacher.<init>(Cacher.java:16)
        at com.thales.src.Main.main(Main.java:43)
Jun 16, 2006 4:41:50 PM 
org.apache.jcs.engine.control.CompositeCacheConfigurator parseAuxiliary
SEVERE: Could not instantiate auxFactory named "DC".
Jun 16, 2006 4:41:50 PM 
org.apache.jcs.engine.control.CompositeCacheConfigurator parseAuxiliary
SEVERE: Could not instantiate auxFactory named "RFailover".
Jun 16, 2006 4:41:50 PM 
org.apache.jcs.engine.control.CompositeCacheConfigurator parseRegions
INFO: Parsed regions [ABCache]
Jun 16, 2006 4:41:50 PM 
org.apache.jcs.engine.control.CompositeCacheConfigurator doConfigure
INFO: Finished configuration in 1360 ms.
org.apache.jcs.access.exception.CacheException: com.thales.src.Student
Caching Unsuccessful for {Name = Mary Smith, School = null, Address = 456 
Oak Drive Pleasantville, CA  94555}
Courses:
{Title = Intro to Foo, Instructor = Jones, Room = null}

org.apache.jcs.access.exception.CacheException: com.thales.src.Student
Caching Unsuccessful for {Name = Joe Smith, School = Engineering, Address 
= 456 Oak Drive Pleasantville, CA  94555}
Courses:
{Title = Intro to Foo, Instructor = Jones, Room = null}


______________________________________________________________________
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message