Ok, I've figured out the problem with loading the config file.  JCS is 
using getResourcesAsStream() and so I needed to 

a) set cfg as follows  'String cfg = "/dsm-jcs.ccf";'
b) put the file in the Eclipse src directory.  This shouldn't be necessary 
since the program was running in the project directory and the classpath 
included that project directory.  But, this is probably not a JCS issue. 


David Wood 
Computing Systems for Wireless Networks
IBM TJ Watson Research Center
daw...@us.ibm.com
914-784-5123 (office), 914-396-6515 (mobile)




From:   David Wood/Watson/IBM@IBMUS
To:     "JCS Users List" <jcs-users@jakarta.apache.org>
Date:   06/09/2011 09:38 AM
Subject:        Re: configuration file loading problem



Oh, and I should have mentioned that I get this even if the config file is 

empty, but here is the non-empty one....

jcs.default=LTCP
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=1000
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.
lru.LRUMemoryCache

# Lateral TCP 
jcs.auxiliary.LTCP=org.apache.jcs.auxiliary.lateral.LateralCacheFactory
jcs.auxiliary.LTCP.attributes=org.apache.jcs
.auxiliary.lateral.LateralCacheAttributes
jcs.auxiliary.LTCP.attributes.TransmissionTypeName=TCP
jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1111
jcs.auxiliary.LTCP.attributes.TcpListenerPort=1110
jcs.auxiliary.LTCP.attributes.PutOnlyMode=false

# UDP discovery for 
jcs.auxiliary.LTCP=org.apache.jcs.auxiliary.lateral.socket.tcp
.LateralTCPCacheFactory
jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.socket.tcp
.TCPLateralCacheAttributes
jcs.auxiliary.LTCP.attributes.TcpListenerPort=1110
jcs.auxiliary.LTCP.attributes.PutOnlyMode=true
jcs.auxiliary.LTCP.attributes.UdpDiscoveryAddr=228.5.6.8
jcs.auxiliary.LTCP.attributes.UdpDiscoveryPort=6780
jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=true

David Wood 
Computing Systems for Wireless Networks
IBM TJ Watson Research Center
daw...@us.ibm.com
914-784-5123 (office), 914-396-6515 (mobile)




From:   David Wood/Watson/IBM@IBMUS
To:     jcs-users@jakarta.apache.org
Date:   06/09/2011 09:29 AM
Subject:        configuration file loading problem



Hi,

I'm considering using JCS 1.3  for a distributed registry in a Mobile 
Adhoc Network (MANET), with the following requirements:

1) No central server
2) More than one JVM per ip address

There may be more, but those are the ones that I think cause the most 
trouble.  So the first question: Can JCS do this (particularly 2)?  I've 
looked at the UDP discovery and Lateral TCP, which together suggest that 
it can. 

Next, I've tried to build a simple program that creates a cache, but it 
throws an exception about loading the config file....

./dsm-jcs.ccf exists.
Jun 9, 2011 9:26:38 AM org.apache.jcs.engine.control.CompositeCacheManager 


getUnconfiguredInstance
INFO: Instance is null, creating with provided config
Jun 9, 2011 9:26:38 AM org.apache.jcs.engine.control.CompositeCacheManager 


configure
INFO: Creating cache manager from config file: ./dsm-jcs.ccf
Jun 9, 2011 9:26:38 AM org.apache.jcs.engine.control.CompositeCacheManager 


configure
SEVERE: Failed to load properties for name [./dsm-jcs.ccf]
Exception in thread "main" java.lang.IllegalStateException: Failed to load 


properties for name [./dsm-jcs.ccf]
        at org.apache.jcs.engine.control.CompositeCacheManager.configure(
CompositeCacheManager.java:242)
        at org.apache.jcs.JCS.ensureCacheManager(JCS.java:102)
        at org.apache.jcs.JCS.getInstance(JCS.java:64)
        at Anything.main(Anything.java:21)

I'm running this from within Eclipse and the code is as follows:

        public static void main(String argv[]) throws CacheException {
                String cfg = "./dsm-jcs.ccf";
                File f = new File(cfg);
                if (f.exists())
                        System.err.println(cfg + " exists.");
                else
                        System.err.println(cfg + " does NOT exist.");
                JCS.setConfigFilename("./dsm-jcs.ccf");
            JCS jcs = JCS.getInstance("DSM"); 
            jcs.put("me", "here");
        }

with ./dsm-jcs.ccf file located in the Eclipse project directory (where 
the main() is being run). 


Thanks in advance for you help.


David Wood 
Computing Systems for Wireless Networks
IBM TJ Watson Research Center
daw...@us.ibm.com
914-784-5123 (office), 914-396-6515 (mobile)


Reply via email to