Another unnamed CacheManager already exists in the same VM (ehCache 2.5)

前端 未结 17 1974
囚心锁ツ
囚心锁ツ 2020-11-30 20:41

This is what happens when I run my junit tests...

Another CacheManager with same name \'cacheManager\' already exists in the same VM. Please 
provide unique          


        
17条回答
  •  囚心锁ツ
    2020-11-30 21:22

    For future readers, the cause of this problem in my case was that in my pom.xml file I had imported the hibernate-ehcache library, which unknown to me also already contained the ehcache library, and then explicitly imported the net.sf.ehache libray.

    This seemed to work fine when I was running as a standalone app (a command line utility for example) but it caused the error in the original post when running on a tomcat server.

    Changing my pom file from:

            
                org.hibernate
                hibernate-ehcache
                5.0.2.Final
            
            
                net.sf.ehcache
                ehcache
                2.7.4
            
    

    To:

            
                org.hibernate
                hibernate-ehcache
                5.0.2.Final
            
            
    

    Fixed the problem. If anyone has any idea why the problem only appeared when running in a tomcat container I'd be interested to know..

提交回复
热议问题