title: How to identify the path of the infinispan configuration xml file
body: <p>I am a newbie to infinispan and would like to seek help about issue below.</p>
  
  <p>I tried to start a infinispan cache on an ejb, such that it should be shared among several applications.</p>
  
  <pre><code>@Singleton  
  public class CSysAppCacheServiceImpl implements CSysAppCacheService {  
  
  private DefaultCacheManager cacheManager;  
  
  private Cache testingCache;  
  
  @EJB(name = "postService")  
  private CSysPostDao postService;  
  
  @EJB(name = "roleService")  
  private CSysRoleDao roleService;  
  
  
  protected Map&lt;String, List&lt;CSysRole&gt;&gt; sysRoleMap;  
  protected Map&lt;String, List&lt;CSysPost&gt;&gt; sysPostMap;  
  protected List&lt;CSysRole&gt; sysRoleList;  
  protected List&lt;CSysPost&gt; sysPostList;  
  
  
  @PostConstruct  
  public void init() {  
          // perform some initialization logic  
          try {  
              System.out.println("init CacheManager start");  
              cacheManager = new DefaultCacheManager("/demo-infinispan.xml");  
              System.out.println("init CacheManager end");  
          } catch (IOException e) {  
              // TODO Auto-generated catch block  
              e.printStackTrace();  
          }  
  
  
  
          testingCache = cacheManager.getCache("testingCache");  
          preloadCache();  
  
  }  
  
  
  // Pre-load cache when server startup  
  public void preloadCache() {  
      for (CacheKey ck : CacheKey.values()) {  
          resetCache(ck);  
      }  
  }  
  
  
  
  
  public void resetCache(CacheKey key) {  
      if (key == null) {  
          for (CacheKey ck : CacheKey.values()) {  
              resetCache(ck);  
          }  
      } else if (key.equals(CacheKey.SYS_ROLE_LIST)) {  
          this.sysRoleList = roleService.findAllRole();  
          setupCacheList(CacheKey.SYS_ROLE_LIST, sysRoleList);  
      } else if (key.equals(CacheKey.SYS_POST_LIST)) {  
          this.sysPostList = postService.findAllPost();  
          setupCacheList(CacheKey.SYS_POST_LIST, sysPostList);  
      }  
  }  
  
  
  protected &lt;T&gt; void setupCacheList(CacheKey key, List&lt;T&gt; list) {  
      testingCache.put(key, list);  
  }  
  
  public List&lt;Object&gt; getCacheList(CacheKey key) {  
      return (List&lt;Object&gt;) testingCache.get(key);  
  }  
  
  public List&lt;Object&gt; getCacheList(String keyString) {  
      return (List&lt;Object&gt;) testingCache.get(keyString);  
  }  
  
  
  @SuppressWarnings("unchecked")  
  public &lt;K, V&gt; Map&lt;K, V&gt; getCacheMap(CacheKey key) {  
      return (Map&lt;K, V&gt;) testingCache.get(key);  
  }  
  
  
  public Map&lt;String, List&lt;CSysRole&gt;&gt; getCSysRoleMap() {  
      sysRoleMap = getCacheMap(CacheKey.SYS_ROLE_LIST);  
      if (MapUtils.isEmpty(sysRoleMap)) {  
          resetCache(CacheKey.SYS_ROLE_LIST);  
      }  
      return sysRoleMap;  
  }  
  
  
  public Map&lt;String, List&lt;CSysPost&gt;&gt; getCSysPostMap() {  
      sysRoleMap = getCacheMap(CacheKey.SYS_POST_LIST);  
      if (MapUtils.isEmpty(sysPostMap)) {  
          resetCache(CacheKey.SYS_POST_LIST);  
      }  
      return sysPostMap;  
  }  
  }  
  </code></pre>
  
  <p>The ejb is init via following class</p>
  
  <pre><code>@ViewScoped  
  @Named  
  public class CacheView implements Serializable {  
  
  
  private static final long serialVersionUID = 1L;  
  
  
  private static final Logger logger = LogManager.getLogger(CacheView.class);  
  
  
  public static final String FNCT_ID = "SAMPLCACH";  
  
  
  private List&lt;String&gt; cacheKeyList;  
  
  // private Map&lt;K, V&gt; selectedMap;  
  private CacheKey selectedKey;  
  private List&lt;Object&gt; selectedList;  
  
  
  @EJB CSysAppCacheService appScopeCache;  
  
  @PostConstruct  
  public void init() {  
          appScopeCache.init();  
  
  }  
  
  ...  
  </code></pre>
  
  <p>}}}}  </p>
  
  <p>But when the application start, following exception raised</p>
  
  <pre><code>Caused by: java.lang.NoClassDefFoundError: org/jboss/marshalling/ClassResolver  
  at org.infinispan.configuration.global.SerializationConfiguration.&lt;clinit&gt;(SerializationConfiguration.java:16)  
  at org.infinispan.configuration.global.SerializationConfigurationBuilder.&lt;init&gt;(SerializationConfigurationBuilder.java:27)  
  at org.infinispan.configuration.global.GlobalConfigurationBuilder.&lt;init&gt;(GlobalConfigurationBuilder.java:43)  
  at org.infinispan.configuration.parsing.ConfigurationBuilderHolder.&lt;init&gt;(ConfigurationBuilderHolder.java:25)  
  at org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:122)  
  at org.infinispan.manager.DefaultCacheManager.&lt;init&gt;(DefaultCacheManager.java:311)  
  at org.infinispan.manager.DefaultCacheManager.&lt;init&gt;(DefaultCacheManager.java:286)  
  at org.infinispan.manager.DefaultCacheManager.&lt;init&gt;(DefaultCacheManager.java:274)  
  at CSysAppCacheServiceImpl.init(CSysAppCacheServiceImpl.java:58)  
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
  at java.lang.reflect.Method.invoke(Method.java:498)  
  at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptor.java:96)  
  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)  
  at org.jboss.as.weld.interceptors.Jsr299BindingsInterceptor.doLifecycleInterception(Jsr299BindingsInterceptor.java:122)  
  at org.jboss.as.weld.interceptors.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:111)  
  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)  
  at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:509)  
  at org.jboss.weld.module.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:72)  
  at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:89)  
  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)  
  at org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:53)  
  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)  
  at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:112)  
  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)  
  at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:112)  
  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)  
  at org.jboss.as.ee.component.AroundConstructInterceptorFactory$1.processInvocation(AroundConstructInterceptorFactory.java:28)  
  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)  
  at org.jboss.as.weld.injection.WeldInterceptorInjectionInterceptor.processInvocation(WeldInterceptorInjectionInterceptor.java:56)  
  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)  
  at org.jboss.as.weld.interceptors.Jsr299BindingsCreateInterceptor.processInvocation(Jsr299BindingsCreateInterceptor.java:105)  
  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)  
  at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)  
  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)  
  at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:237)  
  ... 150 more  
  </code></pre>
  
  <p>The problem should be at line</p>
  
  <p>cacheManager = new DefaultCacheManager("/demo-infinispan.xml");  </p>
  
  <p>the xml is just a simple standlone cache as below</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;  
  &lt;infinispan  
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
        xsi:schemaLocation="urn:infinispan:config:9.0 http://www.infinispan.org/schemas/infinispan-config-9.0.xsd"  
        xmlns="urn:infinispan:config:9.0"&gt;  
  
        &lt;cache-container name="testing" default-cache="default"&gt;  
            &lt;local-cache name="default"&gt;  
            &lt;eviction max-entries="5000" strategy="LIRS" /&gt;  
      &lt;/local-cache&gt;  
        &lt;/cache-container&gt;  
  &lt;/infinispan&gt;  
  </code></pre>
  
  <p>I tried to put the demo-infinispan.xml in either of the following path, but still exception raised</p>
  
  <p>1) same folder of the java bean</p>
  
  <p>2) src folder of the package</p>
  
  <p>3) same folder of the view bean</p>
  
  <p>Would anyone advise where the xml should I put?</p>
  
  <p>Thanks.</p>
  
  <p>Best Regards,</p>