Hi,
I am trying for long to fix this error but cant. I am using
WSAD with JRE 1.5 to compile. Have loaded all the required jars
commons,concurrent etc etc.I have the cache,ccf file in classes
directory
public class SummaryCacheController {
private static final String DELIMITER ="_";
private static final String CACHENAME ="summaryCache";
private static final String OBJ_PREFIX ="summaryObj";
//singleton Cache object
private static SummaryCacheController instance;
//to verify the Object instance count
public static int checkedOut = 0;
private static JCS summaryCache ;
private SummaryCacheController()
throws GISViewerException
{
try {
JCS.setConfigFilename("/cache.ccf");
summaryCache = JCS.getInstance("summaryCache");
} catch (Exception e) {
e.printStackTrace();
//throw new GISViewerException("Exception in intialising
JCS Cache");
}
}
public static SummaryCacheController getInstance()
throws GISViewerException
{
//For creating singleton object of summaryCache object
synchronized (SummaryCacheController.class)
{
if (instance == null)
{
instance = new SummaryCacheController();
}
}
synchronized (instance)
{
instance.checkedOut++;
}
return instance;
}
public List getFromCache(
String eventName,
String boundaryName,
String thematicName)
{
//summaryObj will have the list if available in Cache or null if
not
List summaryObj = null;
String id = eventName + boundaryName + thematicName;
System.out.println("to retrieve:" + id);
summaryObj = (List) summaryCache.get("summaryObj" + id);
return summaryObj;
}
public void setInCache(
String eventName,
String boundaryName,
String thematicName,
List summaryObj)
throws GISViewerException
{
String id = eventName + boundaryName + thematicName;
try{
System.out.println("to put:" + id);
summaryCache.put("summaryObj" + id, summaryObj);
}
catch(Exception e)
{
e.printStackTrace();
//throw new GISViewerException("Exception in retrieving JCS
Cache");
}
}
public void clearCache()
throws GISViewerException
{
try {
summaryCache.clear();
} catch (CacheException e) {
e.printStackTrace();
//throw new GISViewerException("Exception in clearing JCS
Cache");
}
}
}
The code is similar to example given in JCS website. But when I
public class SummaryCacheTestStub {
public static void main(String[] args)
{
try {
SummaryCacheController sControl =
SummaryCacheController.getInstance();
I get an 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.NullPointerException
at
com.trend.iwss.jscan.appscan.runtime.PolicyRuntime.getB64StrProp(PolicyR
untime.java:188)
at
com.trend.iwss.jscan.appscan.runtime.PolicyRuntime.<init>(PolicyRuntime.
java:91)
at
com.trend.iwss.jscan.appscan.runtime.MiscPolicyRuntime.<init>(MiscPolicy
Runtime.java:132)
at
com.trend.iwss.jscan.appscan.runtime.MiscPolicyRuntime$Factory.make(Misc
PolicyRuntime.java:254)
at
com.trend.iwss.jscan.appscan.runtime.PolicyRuntime.accessInstance(Policy
Runtime.java:225)
at
com.trend.iwss.jscan.appscan.runtime.PolicyRuntime.preFilter(PolicyRunti
me.java:127)
at
com.trend.iwss.jscan.appscan.runtime.MiscPolicyRuntime.preFilter(MiscPol
icyRuntime.java:142)
at
org.apache.jcs.engine.control.CompositeCacheManager.configure(CompositeC
acheManager.java:282)
at
org.apache.jcs.engine.control.CompositeCacheManager.configure(CompositeC
acheManager.java:255)
at
org.apache.jcs.engine.control.CompositeCacheManager.configure(CompositeC
acheManager.java:242)
at org.apache.jcs.JCS.ensureCacheManager(JCS.java:105)
at org.apache.jcs.JCS.getInstance(JCS.java:64)
at
com.fpl.ocs.graphicalviewer.objectmodel.summary.SummaryCacheController.<
init>(SummaryCacheController.java:59)
at
com.fpl.ocs.graphicalviewer.objectmodel.summary.SummaryCacheController.g
etInstance(SummaryCacheController.java:75)1
at
com.fpl.ocs.graphicalviewer.objectmodel.summary.SummaryCacheTestStub.mai
n(SummaryCacheTestStub.java:25)
Could someone please help me resolve this!!
Thanks and Regards
Anand Inbasekaran
**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
for the use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further, you are
not to copy, disclose, or distribute this e-mail or its contents to any other
person and any such actions are unlawful. This e-mail may contain viruses.
Infosys has taken every reasonable precaution to minimize this risk, but is not
liable for any damage you may sustain as a result of any virus in this e-mail.
You should carry out your own virus checks before opening the e-mail or
attachment. Infosys reserves the right to monitor and review the content of all
messages sent to or from this e-mail address. Messages sent to or from this
e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***