3 Replies Latest reply on Nov 7, 2012 2:07 AM by Nikolai Alexeev

    "Domain already registered" after EAR is redeployed

    Nikolai Alexeev Newbie

      Hi!

      I've just started using Infinispan and immediately fell in trouble: i can't create DefaultCacheManager after application is redeployed without restarting web server. I get this exception:

      org.infinispan.jmx.JmxDomainConflictException: Domain already registered org.infinispan when trying to register: type=CacheManager,name="DefaultCacheManager"
          at org.infinispan.jmx.JmxUtil.buildJmxDomain(JmxUtil.java:73)
          at org.infinispan.jmx.CacheManagerJmxRegistration.updateDomain(CacheManagerJmxRegistration.java:100)
          at org.infinispan.jmx.CacheManagerJmxRegistration.buildRegistrar(CacheManagerJmxRegistration.java:94)
          at org.infinispan.jmx.AbstractJmxRegistration.registerMBeans(AbstractJmxRegistration.java:59)
          at org.infinispan.jmx.CacheManagerJmxRegistration.start(CacheManagerJmxRegistration.java:62)
          at org.infinispan.manager.DefaultCacheManager.start(DefaultCacheManager.java:709)
          at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:383)
          at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:356)
          at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:342)
      

      At first start everything works fine.

      This is how i create CacheManager (SystemException is our internal class):

      public class CacheManager {
          private static DefaultCacheManager manager;
          
          public static DefaultCacheManager getCacheManager() throws SystemException {
              if (manager == null) {
                  try {
                      manager = new DefaultCacheManager(FacesContext.getCurrentInstance()
                              .getExternalContext().getResourceAsStream("/WEB-INF/infinispan.xml"));
                  } catch (IOException e) {
                      throw new SystemException(e);
                  }
              }
              return manager;
          }
      }
      

      infinispan.xml contains just this:

      <infinispan />
      

      What should i do to get rid of this exception? If this cache somehow is still running after application is redeployed (without restarting web server) how can i use it instead of creating new one?

      Web server is Weblogic 10.3.0. JSF 1.2.