1 Reply Latest reply on May 6, 2014 7:17 AM by Radoslav Husar

    Looking up Infinispan cache dynamically

    Philippe Marschall Expert

      In our application we're looking up Infinispan caches dynamically using the approach described in Getting Started Guide - JBoss AS 7 - Infinispan 6.0 - Project Documentation Editor (yes I see it's deprecated but the section in the Infinispan Documentation just reads "TODO").

       

      Our observations are:

      • @Resource injection into servlets does not work with metadata-complete="true". This is a bit surprising to us because our understanding is that metadata-complete="true" just disables scanning for annotated components (@WebServlet, @WebFilter, ) not resource injection.
      • JNDI lookup only works if the cache has previously been @Resource injected into a component. Otherwise we get the following exception:

      Caused by: javax.naming.NameNotFoundException: Error looking up infinispan/cache/controller-cache-container/controller-cache, service service jboss.naming.context.java.jboss.infinispan.cache.controller-cache-container.controller-cache is not started

      at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:132)

      at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:80)

      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:197)

      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:174)

      at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:122)

      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:183)

      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)

      at javax.naming.InitialContext.lookup(InitialContext.java:411)

      We tested with WildFly 8 beta1 and the behavior is the same. Is that expected or should we create a bug?

       

      Message was edited by: Philippe Marschall fix metadata-complete