0 Replies Latest reply on Apr 24, 2007 12:41 PM by Jorge Morales

    ClusteredCache fails with Region activation/inactivation

    Jorge Morales Master

      Hi, I have a 2 node cache, and I use ClusterCacheLoader (JBossCache 1.4.1.SP3). I set inactiveOnStartup to true on startup of the AS, and as I deploy applications taht uses the cache, I activate the regions it uses programatically.
      Problem is that when I deploy an app, in node one, it works perfectly. Then I deploy/start application in node 2, an exception is thrown.

      java.lang.NullPointerException
       at org.jboss.cache.loader.ClusteredCacheLoader.callRemote(ClusteredCacheLoader.java:98)
       at org.jboss.cache.loader.ClusteredCacheLoader.getChildrenNames(ClusteredCacheLoader.java:66)
       at org.jboss.cache.loader.AsyncCacheLoader.getChildrenNames(AsyncCacheLoader.java:157)
      


      I downloaded the source code, and fixed my problem by doing this:
      replaced (in ClusteredCacheLoader):
      if (((Boolean) clusteredGetResp.get(0)).booleanValue())
      


      with:
      Boolean resp = (Boolean) ((clusteredGetResp!=null && clusteredGetResp.size()>0)? clusteredGetResp.get(0):null);
      if (resp !=null && resp.booleanValue())
      


      Also, I have seen this is not aplicable to 2.0 branch, as it uses Java 5 features.

      I don`t know if this is a bug, or I`m doing something wrong. Probably you can evaluate it better than I.

      Another question is in documentation it states that whenever you want to use region activation/inactivation with cacheloader, the cacheloader should implement ExtendedCacheLoader, which ClusteredCacheLoader does not.

      Thanks