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

Knox ehcache usage has intermittent CacheManger exception

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.11.0
    • Component/s: Server, Site
    • Labels:
      None

      Description

      There is an intermittent issue when using ehcache in the shiro config. It doesn't seem to happen in a new topology file.

      2016-10-10 08:22:09,171 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:
       1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
       2. Shutdown the earlier cacheManager before creating new one with same name.
       The source of the existing CacheManager is: InputStreamConfigurationSource stream=sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream@42caa857
       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)
       at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:61)
       at org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:129)
       at org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:161)
       at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:124)
       at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:102)
       at org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:88)
       at org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:46)
       at org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
       at org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
       at org.apache.shiro.web.env.IniWebEnvironment.createWebSecurityManager(IniWebEnvironment.java:203)
       at org.apache.shiro.web.env.IniWebEnvironment.configure(IniWebEnvironment.java:99)
       at org.apache.shiro.web.env.IniWebEnvironment.init(IniWebEnvironment.java:92)
       at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:45)
       at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:40)
       at org.apache.shiro.web.env.EnvironmentLoader.createEnvironment(EnvironmentLoader.java:221)
       at org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:133)
       at org.apache.shiro.web.env.EnvironmentLoaderListener.contextInitialized(EnvironmentLoaderListener.java:58)
       at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782)
       at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424)
       at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774)
       at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
       at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
       at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
       at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
       at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
       at org.apache.hadoop.gateway.GatewayServer.internalDeploy(GatewayServer.java:364)
       at org.apache.hadoop.gateway.GatewayServer.access$700(GatewayServer.java:72)
       at org.apache.hadoop.gateway.GatewayServer$InternalTopologyListener.handleCreateDeployment(GatewayServer.java:441)
       at org.apache.hadoop.gateway.GatewayServer$InternalTopologyListener.handleTopologyEvent(GatewayServer.java:402)
       at org.apache.hadoop.gateway.services.topology.impl.DefaultTopologyService.notifyChangeListeners(DefaultTopologyService.java:347)
       at org.apache.hadoop.gateway.services.topology.impl.DefaultTopologyService.reloadTopologies(DefaultTopologyService.java:321)
       at org.apache.hadoop.gateway.services.topology.impl.DefaultTopologyService.onFileChange(DefaultTopologyService.java:418)
       at org.apache.commons.io.monitor.FileAlterationObserver.doMatch(FileAlterationObserver.java:400)
       at org.apache.commons.io.monitor.FileAlterationObserver.checkAndNotify(FileAlterationObserver.java:334)
       at org.apache.commons.io.monitor.FileAlterationObserver.checkAndNotify(FileAlterationObserver.java:304)
       at org.apache.commons.io.monitor.FileAlterationMonitor.run(FileAlterationMonitor.java:182)
       at java.lang.Thread.run(Thread.java:745)
       Caused by: 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:
       1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
       2. Shutdown the earlier cacheManager before creating new one with same name.
       The source of the existing CacheManager is: InputStreamConfigurationSource stream=sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream@42caa857
       at net.sf.ehcache.CacheManager.assertNoCacheManagerExistsWithSameName(CacheManager.java:460)
       at net.sf.ehcache.CacheManager.init(CacheManager.java:349)
       at net.sf.ehcache.CacheManager.<init>(CacheManager.java:317)
       at org.apache.shiro.cache.ehcache.EhCacheManager.ensureCacheManager(EhCacheManager.java:213)
       ... 40 more

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sumit.gupta Sumit Gupta
                Reporter:
                sumit.gupta Sumit Gupta
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: