Uploaded image for project: 'Apache Knox'
  1. Apache Knox
  2. KNOX-1165

Another unnamed CacheManager already exists in the same VM



    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 0.12.0, 0.13.0, 0.14.0, 1.0.0, 1.1.0
    • 1.2.0
    • Server, Site
    • None
    • JDK 1.8
      CentOS-6 (64bit)


      Solution: See updated documentation here: https://knox.apache.org/books/knox-1-2-0/user-guide.html#LDAP+Authentication+Caching

      Ensure that the following is set:



      Issue is described on the note "Error:Shiro environment initialization failed" when starting Knox;

      ERROR env.EnvironmentLoader (EnvironmentLoader.java:initEnvironment(146)) - Shiro environment initialization failed
       org.apache.shiro.cache.CacheException: net.sf.ehcache.CacheException: Another unnamed CacheManager already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following 

      After implementing the solution of creating a new ehcache.xml and reference as <ehcache name="knox-mytopology1"> we still see the issue:

      Caused by: net.sf.ehcache.CacheException: Another CacheManager with same name 'knox-tp' already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following: 

      Steps to reproduce

      When enabling the following parameters: 


      More Info

      This KNOX-804 was open to solve this same issue but is not documented anywhere, but we can see the coding changes in GitHub.

      • Accordingly with shiro documentation: 
        • /**
          Initializes this instance.
          If a {@link #setCacheManager CacheManager} has been explicitly set (e.g. via Dependency Injection or programmatically) prior to calling this
          method, this method does nothing.
          However, if no {@code CacheManager} has been set, the default Ehcache singleton will be initialized, where Ehcache will look for an {@code ehcache.xml} file at the root of the classpath. If one is not found, Ehcache will use its own failsafe configuration file.
          Because Shiro cannot use the failsafe defaults (fail-safe expunges cached objects after 2 minutes, something not desirable for Shiro sessions), this class manages an internal default configuration for this case.
          @throws org.apache.shiro.cache.CacheException if there are any CacheExceptions thrown by EhCache.
          @see net.sf.ehcache.CacheManager#create
          public final void init() throws CacheException { ensureCacheManager(); }
          private net.sf.ehcache.CacheManager ensureCacheManager()
          { ***It fails in here. }
      • This is the head of the exception: The source of the existing CacheManager is:
        • InputStreamConfigurationSource [stream=java.io.BufferedInputStream@675ffd1d] at org.apache.shiro.cache.ehcache.EhCacheManager.ensureCacheManager(EhCacheManager.java:224) at org.apache.shiro.cache.ehcache.EhCacheManager.init(EhCacheManager.java:199) at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:45) at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:40)


        Issue Links



              krisden Kevin Risden
              emattosHWX Ernani Pereira de Mattos Junior
              0 Vote for this issue
              3 Start watching this issue