2 Replies Latest reply on Mar 19, 2015 7:32 AM by Robert Sperlazza

    Infinispan with WildFly 8 cache-container

    Robert Sperlazza Newbie

      I have been trying to configure a standalone.xml to have create my own cache with the following stub under <subsystem xmlns="urn:jboss:domain:infinispan:2.0">:

       

      <cache-container name="myCache" default-cache="dist" start="EAGER">

                      <local-cache name="myCacheDb" start="EAGER"/>

      </cache-container>

       

      The main problem is when I create my java class to inject the cache the container is always null. What is the proper way to way to initialize the container so that I can used it for basic caching.

       

      Below is my java class:

       

      import javax.annotation.Resource;

       

      import org.infinispan.manager.CacheContainer;

       

      public class CacheContainerTest {

        @Resource(lookup = "java:jboss/infinispan/container/myCache")

        private org.infinispan.manager.CacheContainer container;

       

        public CacheContainerTest getContainer() {

        return container;

        }

      }

       

      In another java class:

      CacheContainerTest cct = new CacheContainerTest();

      org.infinispan.manager.CacheContainer cc = cct.getContainer();               //cc is null

      Cache<String, Object> cache = c.getCache();

       

      Any help would be very much appreciate.