Aurelien created Bug HHH-7565
Issue Type: Bug Bug
Affects Versions: 3.6.7
Assignee: Unassigned
Components: caching (L2)
Created: 02/Sep/12 7:35 AM
Description:

Since Ehcache 2.5, a CacheManager needs to be named.
If creating two SessionFactory instances in the same VM, and enabling Ehcache as a 2nd level cache, this factories will try to to instantiate the default Ehcache CacheManagers, thus causing the exception:

org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Another CacheManager with same name 'hibernate' 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: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ]
	at net.sf.ehcache.hibernate.EhCacheRegionFactory.start(EhCacheRegionFactory.java:89)
	at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:238)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872)

Shouldn't the SessionFactory try instead to get the CacheManager singleton through CacheManager.create() when using the default CacheManager?

Project: Hibernate ORM
Priority: Major Major
Reporter: Aurelien
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira