1 Reply Latest reply on Apr 14, 2016 12:21 AM by Ayesha B

    inifinispan in jbossas7 resource lookup problem

    Ayesha B Newbie

      Hello ,

      • I have configured a local cache in standalone.xml

                  <cache-container name="jboss-micro" default-cache="jboss-micro-cache">

                      <local-cache name="jboss-micro-cache" start="EAGER"/>

                  </cache-container>

      • I am trying to do a resource lookup like this.

                     @Resource(lookup="java:comp/env/cache/master-data")

                     private CacheContainer container;

      • In web.xml

                     <resource-env-ref> 

                         <resource-env-ref-name>cache/master-data</resource-env-ref-name> 

                         <resource-env-ref-type>org.infinispan.manager.EmbeddedCacheManager</resource-env-ref-type> 

                         <lookup-name>java:jboss/infinispan/container/jboss-micro</lookup-name> 

                     </resource-env-ref>

      • I get null pointer exception when accessing 'container'.
      • When I do a jndi lookup, it works fine

                  Context ctx = new InitialContext();

                  container = (CacheContainer) ctx.lookup("java:comp/env/cache/master-data");

       

      Can anyone help?