13 Replies Latest reply on Aug 15, 2016 7:27 AM by Sebastian Łaskawiec

    Problem with Infinispan CDI

    Seto Kaiba Expert

      Exception in thread "Thread-2" org.infinispan.jmx.JmxDomainConflictException: ISPN000034: There's already a JMX MBean instance type=CacheManager,name="CDIExtensionDefaultCacheManager" already registered under 'org.infinispan' JMX domain. If you want to allow multiple instances configured with same JMX domain enable 'allowDuplicateDomains' attribute in 'globalJmxStatistics' config element

        at org.infinispan.jmx.JmxUtil.buildJmxDomain(JmxUtil.java:52)

        at org.infinispan.jmx.CacheManagerJmxRegistration.updateDomain(CacheManagerJmxRegistration.java:79)

        at org.infinispan.jmx.CacheManagerJmxRegistration.buildRegistrar(CacheManagerJmxRegistration.java:73)

        at org.infinispan.jmx.AbstractJmxRegistration.registerMBeans(AbstractJmxRegistration.java:37)

        at org.infinispan.jmx.CacheManagerJmxRegistration.start(CacheManagerJmxRegistration.java:41)

        at org.infinispan.manager.DefaultCacheManager.start(DefaultCacheManager.java:657)

        at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:232)

        at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:209)

        at org.infinispan.cdi.DefaultEmbeddedCacheManagerProducer.getDefaultEmbeddedCacheManager(DefaultEmbeddedCacheManagerProducer.java:43)

        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:497)

        at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:88)

        at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:78)

        at org.jboss.weld.injection.producer.ProducerMethodProducer.produce(ProducerMethodProducer.java:99)

        at org.jboss.weld.injection.producer.AbstractMemberProducer.produce(AbstractMemberProducer.java:161)

        at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:181)

        at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)

        at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)

        at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:141)

        at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)

        at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)

        at org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)

        at org.infinispan.manager.BasicCacheContainer$CacheContainer$EmbeddedCacheManager$Lifecycle$Listenable$274507849$Proxy$_$$_WeldClientProxy.toString(Unknown Source)

        at java.lang.String.valueOf(String.java:2994)

        at java.lang.StringBuilder.append(StringBuilder.java:131)

        at org.infinispan.cdi.util.Reflections.buildInvokeMethodErrorMessage(Reflections.java:87)

        at org.infinispan.cdi.util.Reflections.invokeMethod(Reflections.java:203)

        at org.infinispan.cdi.util.Reflections.invokeMethod(Reflections.java:126)

        at org.infinispan.cdi.util.InjectableMethod.invoke(InjectableMethod.java:153)

        at org.infinispan.cdi.util.InjectableMethod.invoke(InjectableMethod.java:110)

        at org.infinispan.cdi.util.defaultbean.DefaultProducerMethod.destroy(DefaultProducerMethod.java:42)

        at org.jboss.weld.util.bean.IsolatedForwardingBean.destroy(IsolatedForwardingBean.java:50)

        at org.jboss.weld.context.AbstractContext.destroyContextualInstance(AbstractContext.java:147)

        at org.jboss.weld.context.AbstractContext.destroy(AbstractContext.java:161)

        at org.jboss.weld.context.AbstractSharedContext.destroy(AbstractSharedContext.java:61)

        at org.jboss.weld.context.AbstractSharedContext.invalidate(AbstractSharedContext.java:56)

        at org.jboss.weld.bootstrap.WeldRuntime.shutdown(WeldRuntime.java:56)

        at org.jboss.weld.bootstrap.WeldBootstrap.shutdown(WeldBootstrap.java:113)

        at org.jboss.weld.environment.se.WeldContainer.shutdown(WeldContainer.java:237)

        at org.jboss.weld.environment.se.WeldContainer$ShutdownHook.run(WeldContainer.java:276)

       

      Kernal.java

      package co.kaiba.blueeyes.impl.kernel;

      import co.kaiba.blueeyes.impl.service.data.NameCache;
      import org.infinispan.Cache;
      import org.jboss.weld.environment.se.bindings.Parameters;
      import org.jboss.weld.environment.se.events.ContainerInitialized;

      import javax.enterprise.event.Observes;
      import javax.inject.Inject;
      import javax.inject.Singleton;
      import java.util.List;
      import java.util.Properties;

      /**
      * Created by Seto on 2016/4/21.
      */
      @Singleton
      public class Kernel {

         @Inject
        @NameCache
         Cache<String, String> nameCache;

        public void onContainerInitialized(@Observes ContainerInitialized event, @Parameters List<String> parameters) {

        System.out.println("aaa");
         Properties appProperties;
        if (parameters.size() == 1) {

        appProperties = findProperties(parameters.get(0));
         } else {

        appProperties = findProperties(null);
         }

        }

       

         private static Properties findProperties(String propLoc) {

        Properties baseProperties = new Properties();
        return baseProperties;
         }

      }

       

      DataServiceImpl.java

      package co.kaiba.blueeyes.impl.service.data;

      import org.infinispan.cdi.ConfigureCache;
      import org.infinispan.configuration.cache.Configuration;
      import javax.enterprise.inject.Produces;

      /**
      * Created by Seto on 2016/4/21.
      */
      public class DataServiceImpl {

       

         @ConfigureCache("name-cache")

         @NameCache
        @Produces
         public Configuration nameCacheConfig;
      }

       

      NameCache.java

      package co.kaiba.blueeyes.impl.service.data;

        import javax.inject.Qualifier;
        import java.lang.annotation.*;

      /**
      * Created by Seto on 2016/4/22.
      */
      @Qualifier
      @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})

      @Retention(RetentionPolicy.RUNTIME)

      @Documented
      public @interface NameCache {

      }

      Just a simple enough application. Please help. What's my problem?