Setting up ehcache as secondary cache for Hibernate

Hello everyone,

I’m trying to get an application set up on Lucee. This application was originally set up on Cold Fusion. It uses coldspring for dependency injection. It’s configured to use ehcache for secondary cache in Hibernate. I would like some advice on how to get this working. Right now, enabling the secondary cache for Hibernate generates an error message about duplicate cache manager.

Lucee Version: 5.3.7.48
Hibernate Extension: 3.5.5.77

Application.cfc

	this.ormEnabled = true;
	this.ormSettings = {
		flushatrequestend=false,
		eventhandling=true,
		skipCFCWithError=false,
		savemapping=false,
		secondarycacheenabled=true,
		cacheProvider="ehcache",
		cacheconfig='#this.applicationPath#config/ehcache.xml',
...

ehcache.xml

        <defaultCache
        maxElementsInMemory="100000"
        eternal="false"
        timeToIdleSeconds="3600"
        timeToLiveSeconds="3600"
        overflowToDisk="false"
        diskSpoolBufferSizeMB="30"
        maxElementsOnDisk="10000000"
        diskPersistent="false"
        diskExpiryThreadIntervalSeconds="1800"
        memoryStoreEvictionPolicy="LRU"
        clearOnFlush="true"
        statistics="true"
            />

        <cache
        name="myCache"
        maxElementsInMemory="10000"
        eternal="false"
        timeToIdleSeconds="360"
        timeToLiveSeconds="360"
        overflowToDisk="false"
        diskSpoolBufferSizeMB="30"
        maxElementsOnDisk="10000000"
        diskPersistent="false"
        diskExpiryThreadIntervalSeconds="180"
        memoryStoreEvictionPolicy="LRU"
        clearOnFlush="true"
        statistics="true"
            />
</ehcache>

Below is the error I get.

Message string net.sf.ehcache.CacheException: Another CacheManager with same name 'app_extg50k1qvnjyre' 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: URLConfigurationSource [url=file:/C:/Lucee/tomcat/temp/ehcache/app_extg50k1qvnjyre.xml]
StackTrace string lucee.runtime.exp.NativeException: net.sf.ehcache.CacheException: Another CacheManager with same name 'app_ext50k1qvnjyre' 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: URLConfigurationSource [url=file:/C:/Lucee/tomcat/temp/ehcache/app_extg50k1qvnjyre.xml]
at net.sf.ehcache.hibernate.EhCacheRegionFactory.start(EhCacheRegionFactory.java:89)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:250)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385)
at org.lucee.extension.orm.hibernate.SessionFactoryData.buildSessionFactory(SessionFactoryData.java:208)
at org.lucee.extension.orm.hibernate.HibernateORMEngine.getSessionFactoryData(HibernateORMEngine.java:202)
at org.lucee.extension.orm.hibernate.HibernateORMEngine.create(HibernateORMEngine.java:452)
at org.lucee.extension.orm.hibernate.HibernateORMSession.load(HibernateORMSession.java:644)
at org.lucee.extension.orm.hibernate.HibernateORMSession.load(HibernateORMSession.java:638)
at lucee.runtime.functions.orm.EntityLoad.call(EntityLoad.java:50)
at common.server.security.securityservice_cfc$cf.udfCall1(/ems/common/server/security/SecurityService.cfc:29)
at common.server.security.securityservice_cfc$cf.udfCall(/ems/common/server/security/SecurityService.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:647)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:568)
at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1917)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:864)
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1729)
at beans.support.cfcbeandefinition_cfc$cf.udfCall(/coldspring/beans/support/CFCBeanDefinition.cfc:40)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:217)
at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:779)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:785)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1710)
at beans.support.abstractbeandefinition_cfc$cf.udfCall1(/coldspring/beans/support/AbstractBeanDefinition.cfc:59)
at beans.support.abstractbeandefinition_cfc$cf.udfCall(/coldspring/beans/support/AbstractBeanDefinition.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:217)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:646)
at lucee.runtime.ComponentImpl._call(ComponentI
-- very long stack, omitted 72376 bytes