4 Replies Latest reply on Jun 1, 2015 6:47 AM by emelyanov

    How find CacheContainer by name?

    emelyanov

      I create CacheContainer and Cache in one application and want to access it in another application.

      Both applications are on the same server JBoss.

      The cache must be created programmatically.

        • 1. Re: How find CacheContainer by name?
          wdfink

          That is one reason for Infinispan cache

          You need to have the same configuration in both applications. With the jgroups configuration you build a cluster and then you need to use a clustered cache in replication or distribution mode.

          For more information you should read the Getting started Guide

          Also the quickstarts are useful http://infinispan.org/quickstarts/

          • 2. Re: How find CacheContainer by name?
            emelyanov

            My code

             

                private static EmbeddedCacheManager container;

             

                public Cache getCache() {

                    if (container == null) {

                        container = new DefaultCacheManager(new ConfigurationBuilder()

                                .clustering()

                                .build());

                    }

                    return container.getCache();

                }   

             

            In the first application, everything works fine.

            In the second application, I get an error:

               

            org.infinispan.jmx.JmxDomainConflictException: Domain already registered org.infinispan when trying to register: type=CacheManager,name="DefaultCacheManager"

            • 3. Re: How find CacheContainer by name?
              wdfink

              You need to allow it,

              with new GlobalConfigurationBuilder()......allowDuplicateDomains(true)....

              • 4. Re: How find CacheContainer by name?
                emelyanov

                new GlobalConfigurationBuilder()......allowDuplicateDomains(true)....

                So I got 2 different cache. But I need 1 (common).

                >>> "and want to access it in another application."