1 Reply Latest reply on Mar 13, 2014 12:39 PM by Vladimir Blagojevic

    Infinispan, How to configure Jboss As managed cache manager

    Dinoop P Newbie

      I am trying to use Jboss AS managed Infinispan in my application, so that I can use Jboss Admin console to manage it.

      I have tried the following steps based on Infinispan documentation,


      1) Created a class named Config

      import javax.annotation.Resource;
      import javax.enterprise.context.ApplicationScoped;
      import javax.enterprise.inject.Produces;
      import org.infinispan.manager.EmbeddedCacheManager;
      public class Config {
        @Resource(lookup = "java:jboss/infinispan/test")
        private EmbeddedCacheManager defaultCacheManager;
        public void printObject() {

      2) created a servlet just for making Config object and calling printObject() method


      import java.io.IOException;
      import javax.servlet.ServletException;
      import javax.servlet.http.HttpServlet;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      public class TestServlet extends HttpServlet{
        private static final long serialVersionUID = 3200037917839533696L;
        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doIt(req, resp);
        protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doIt(req, resp);
        protected void doIt(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        try {
        Config config  = new Config();
        } catch (Exception e) {

      3) Added the application dependencies via standalone.xml global configuration


      <subsystem xmlns="urn:jboss:domain:ee:1.0">
                      <module name="org.infinispan" slot="main"/>
                      <module name="javax.enterprise.api" slot="main"/>
                      <module name="javax.faces.api" slot="main"/>
                      <module name="javax.inject.api" slot="main"/>
                      <module name="javax.annotation.api" slot="main"/>



      4)Added new cache container in subsystem named test

      <subsystem xmlns="urn:jboss:domain:infinispan:1.2" default-cache-container="test">
                  <cache-container name="test" default-cache="entity" start="EAGER">
                      <local-cache name="entity"/>


      5)Removed all Infinispan related jars from my application


      But, When I try to call the printObject() method from servel it is printing null


      13:37:24,206 INFO  [stdout] (http-- defaultCacheManager:null


      Why it is happening , please correct me if any thing missed from my side.