Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-2886

Using multiple DefaultCacheManager w/o jmx leads to JmxDomainConflictException

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

      Creating multiple instances of DefaultCacheManager leads to CacheManagerJmxRegistrationTest, even when JMX is disabled in configuration.

      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:75)
      at org.infinispan.jmx.CacheManagerJmxRegistration.updateDomain(CacheManagerJmxRegistration.java:101)
      at org.infinispan.jmx.CacheManagerJmxRegistration.buildRegistrar(CacheManagerJmxRegistration.java:95)
      at org.infinispan.jmx.AbstractJmxRegistration.registerMBeans(AbstractJmxRegistration.java:59)
      at org.infinispan.jmx.CacheManagerJmxRegistration.start(CacheManagerJmxRegistration.java:63)
      at org.infinispan.manager.DefaultCacheManager.start(DefaultCacheManager.java:705)
      at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:300)
      at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:171)

      Update

      This also happens when using CDI Extension in Library mode with Wildfly. Attached Pull Request fixes that case.

            [ISPN-2886] Using multiple DefaultCacheManager w/o jmx leads to JmxDomainConflictException

            The setting is in place. Here is the code sample:

            @Produces
            @ApplicationScoped
            public EmbeddedCacheManager greetingCacheManager(@GreetingCache Configuration configuration) {
                GlobalConfiguration globalConfiguration = new GlobalConfigurationBuilder().globalJmxStatistics().allowDuplicateDomains(true).build();
                return new DefaultCacheManager(globalConfiguration, configuration);
            }
            

            Sebastian Łaskawiec (Inactive) added a comment - The setting is in place. Here is the code sample: @Produces @ApplicationScoped public EmbeddedCacheManager greetingCacheManager(@GreetingCache Configuration configuration) { GlobalConfiguration globalConfiguration = new GlobalConfigurationBuilder().globalJmxStatistics().allowDuplicateDomains( true ).build(); return new DefaultCacheManager(globalConfiguration, configuration); }

            allowDuplicateDomains should solve this.

            Mircea Markus (Inactive) added a comment - allowDuplicateDomains should solve this.

            Thomas Fromm (Inactive) added a comment - - edited

            A solution could be introduce globalConfig.globalJmxStatistics().enabled() check in CacheManagerJmxRegistration.start() but this is in conflict with feature ISPN-2290 :-/

            This makes it not easy to use DefaultCacheManager several times within an application without using one shared. How about making allowDuplicateDomain true as default, even when its nessesary always to register jmx?

            Thomas Fromm (Inactive) added a comment - - edited A solution could be introduce globalConfig.globalJmxStatistics().enabled() check in CacheManagerJmxRegistration.start() but this is in conflict with feature ISPN-2290 :-/ This makes it not easy to use DefaultCacheManager several times within an application without using one shared. How about making allowDuplicateDomain true as default, even when its nessesary always to register jmx?

              slaskawi@redhat.com Sebastian Łaskawiec (Inactive)
              tfromm_jira Thomas Fromm (Inactive)
              Archiver:
              rhn-support-adongare Amol Dongare

                Created:
                Updated:
                Resolved:
                Archived: