Re: EHCache 2 - SingltonEHCacheRegionFactory for multiple hibernate applcation deployed on Tomcat 8.

24 views
Skip to first unread message

Henri Tremblay

unread,
Nov 27, 2018, 10:29:03 AM11/27/18
to ehcac...@googlegroups.com
Sharing a CacheManager in Tomcat requires some class loader skills.

You need to put Ehcache jars and the configuration at a common class loader level. So the same instance will be shared by everyone. A bit like what you will do for a datasource. Then, however, what you put in cache might be at a higher level. So when an application is stopped, you need to clear the cache to prevent class loader memory leaks.

So, it's not for the faint of heart.

So maybe having one tomcat per application is the way to go. You might lose some memory at duplicate caching but your server configuration will be simpler.

On Tue, 27 Nov 2018 at 08:01, chandrashekhar ghorpade <shekhargh...@gmail.com> wrote:

I have multiple Spring(4.3.6) hibernate(5.2.7) applications. 


Each application has session factory configured with SingletonEhCacheRegionFactory class to enable second level query cache. 

All applications are deployed inside single tomcat server.


Tomcat has shared folder which contains ehcache.xml includes default cache, timestamp and standard query cache. 


I expecting that only 3 cache regions will be created inside jvm and shared by all session factories.

So correct if I am wrong.


And for one application query caching working fine but for second application I getting The org.hibernate.cache.internal.StandardQueryCache Cache is not alive (STATUS_SHUTDOWN) error on line query.setCacheable(true. This exception occurs when one of application is reloaded.


I am attaching logs of ehcache run.


Thanks,

Shekhar

--
You received this message because you are subscribed to the Google Groups "ehcache-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ehcache-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ehcache-dev/07061406-1a27-4b24-96a0-7c45d76e8929%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages