0 Replies Latest reply on Mar 18, 2011 5:39 PM by Susanne Jarl

    Seam JBoss cache - possible to have one cache shared between all wars in an ear?

    Susanne Jarl Newbie

      I have 2 wars in an ear and I use JBoss cache with Seam. Seam 2.2.1.final (jgroups.jar and jboss-cache.jar) and JBoss 5.1.0.GA

      In a.war I use seam cache to cache page fragments. From b.war I would like to remove this cached fragment (because I want it to create a new one because I changed data in the database). Is that possible?
      I tested it and it does not seem to work. I get a warn message like this:

      WARN  [TreeCache] node /myDefinedFragments not found

      So it seems that there is one cache for each war in the ear. Is there any way to configure the cache so that the caching is not isolated?

      In my component.xml in both a.war and b.war I have this code:

      <cache:jboss-cache-provider name="myCache" auto-create="true" configuration="META-INF/cache-configuration.xml" />

      In my ejb session bean I have

      @In (value="myCache")
      CacheProvider<JbossCacheProvider> cacheProvider;

      and my xhtml pages I have

      <s:cache cacheProvider="#{myCache}" key="myKey"  region="/myDefinedFragments">

      and the WARN message I get when I try to remove the myDefinedFragments that is created from a.war when I send a request from b.war

      WARN  [TreeCache] node /myDefinedFragments not found

      Any ideas? Is it possible to have one cache that is shared between all wars in an ear?