jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rathinaganesh <rathinaganesh.t...@gmail.com>
Subject RE: JCS.setConfigFilename
Date Wed, 08 Sep 2010 20:09:34 GMT

Greetings,

I am having the same issue. I have the cache.ccf file under the classes
folder in WEB-INF in my web application.
Here is the sample of my Manager class, which loads the JCS cache.
---------------------
public class CacheManager {

    private static CacheManager instance;
    private static int checkedOut = 0;
    private static JCS processedSlaCache;

    private CacheManager()
    {
        try
        {
//        	JCS.setConfigFilename("cache.ccf");
        	System.out.println("Trying to load the cache....");
        	processedSlaCache = JCS.getInstance("slaCache");
        }
        catch (Exception e)
        {
            // Handle cache region initialization failure
        	e.printStackTrace();
        }

        // Do other initialization that may be necessary, such as getting
        // references to any data access classes we may need to populate
        // value objects later
    }

    /**
     * Singleton access point to the manager.
     */
    public static CacheManager getInstance()
    {
        synchronized (CacheManager.class)
        {
            if (instance == null)
            {
            	System.out.println("instance null");
                instance = new CacheManager();
            }
        }

        synchronized (instance)
        {
            instance.checkedOut++;
        }

        return instance;
    }

   }




---------------------

Here is the sample of my cache file, cache.ccf under
<WEB-APP-NAME>/WEB-INF/classes/cache.ccf

# 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
jcs.default.cacheattributes.UseMemoryShrinker=false
jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=3600
jcs.default.cacheattributes.ShrinkerIntervalSeconds=60
jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
jcs.default.elementattributes.IsEternal=false
jcs.default.elementattributes.MaxLifeSeconds=21600
jcs.default.elementattributes.IdleTime=1800
jcs.default.elementattributes.IsSpool=true
jcs.default.elementattributes.IsRemote=true
jcs.default.elementattributes.IsLateral=true

# PRE-DEFINED CACHE REGIONS
jcs.region.slaCache=DC
jcs.region.slaCache.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.region.slaCache.cacheattributes.MaxObjects=1000
jcs.region.slaCache.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
jcs.region.slaCache.cacheattributes.UseMemoryShrinker=false
jcs.region.slaCache.cacheattributes.MaxMemoryIdleTimeSeconds=3600
jcs.region.slaCache.cacheattributes.ShrinkerIntervalSeconds=60
jcs.region.slaCache.cacheattributes.MaxSpoolPerRun=500
jcs.region.slaCache.elementattributes=org.apache.jcs.engine.ElementAttributes
jcs.region.slaCache.elementattributes.IsEternal=false


---------------------------------------------

Here is the error message .....

11:28:25,203 INFO  [CompositeCacheManager] Creating cache manager from
config file: /cache.ccf
11:28:25,218 INFO  [STDOUT] 11:28:25,218 ERROR [CompositeCacheManager]
Failed to load properties for name [/cache.ccf]
11:28:25,218 ERROR [STDERR] java.lang.IllegalStateException: Failed to load
properties for name [/cache.ccf]
11:28:25,218 ERROR [STDERR] 	at
org.apache.jcs.engine.control.CompositeCacheManager.configure(CompositeCacheManager.java:242)
11:28:25,218 ERROR [STDERR] 	at
org.apache.jcs.engine.control.CompositeCacheManager.configure(CompositeCacheManager.java:194)
11:28:25,218 ERROR [STDERR] 	at
org.apache.jcs.engine.control.CompositeCacheManager.getInstance(CompositeCacheManager.java:122)
11:28:25,218 ERROR [STDERR] 	at
org.apache.jcs.JCS.ensureCacheManager(JCS.java:96)
11:28:25,218 ERROR [STDERR] 	at org.apache.jcs.JCS.getInstance(JCS.java:64)

Any help in this regard would be highly appreciated.

Thanks,
Ganesh.



jordiang wrote:
> 
> JCS looks for the file at the root of the classpath.
> 
> If your code compiles to the directory  "classes\com\nektra\
> ...\MyClass.class", then make sure the file cache.ccf is located right
> under "classes\"
> 
> If you are creating a JAR file with your classes, include the cache.ccf
> in the top directory.
> 
> 
> -Jorge
> 
> -----Original Message-----
> From: Mauro S. Asprea [mailto:mauro.asprea@nektra.com] 
> Sent: Wednesday, May 28, 2008 2:39 PM
> To: jcs-users@jakarta.apache.org
> Subject: JCS.setConfigFilename
> 
> Hi, I'm having aa issue when trying to set the config.ccf file path.
> My code is:
> 
>                     JCS.setConfigFilename("cache.ccf");
>                     cache = JCS.getInstance("default");
> 
> And I'm getting the following exception
> 
>     Failed to load properties for name [cache.ccf]
>     java.lang.IllegalStateException: Failed to load properties for name
>     [cache.ccf]
>         at
>  
> org.apache.jcs.engine.control.CompositeCacheManager.configure(CompositeC
> acheManager.java:242)
>         at org.apache.jcs.JCS.ensureCacheManager(JCS.java:102)
>         at org.apache.jcs.JCS.getInstance(JCS.java:64)
> 
> I tried setting the JCS.setConfigFilename with a absolute path like 
> "c:\mydir\mifile.ccf and the exception keeps throwing.
> 
> So I donwloaded the code of JCS and noted that the 
> CompositeCacheManager.configure didn't read for my dir path. How can I 
> make him to read the file from I want to , or where in my project dirs I
> 
> have to put the config file?
> 
> I don't how to solve this... any clue?
> 
> Thanks!
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jcs-users-help@jakarta.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/JCS.setConfigFilename-tp17519214p29642189.html
Sent from the JCS - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Mime
View raw message