Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6543165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:18:49+00:00 2026-05-25T11:18:49+00:00

I wanted to use Ehcache’s disk persistence with the ability to keep the data

  • 0

I wanted to use Ehcache’s disk persistence with the ability to keep the data between restarts. My configuration looks like this:

<ehcache>

  <diskStore path="/tmp/blah"/>

  <defaultCache
      eternal="true"
      maxElementsInMemory="500"
      overflowToDisk="false"
      memoryStoreEvictionPolicy="LRU"
      statistics="true"/>

  <cache
          name="myCache"
      eternal="true"
      maxElementsInMemory="10"
      maxElementsOnDisk="10000"
      overflowToDisk="true"
      diskPersistent="true"
      memoryStoreEvictionPolicy="LRU"
      statistics="true"/>

</ehcache>

Using the above, I have noticed that not only /tmp/blah/myCache.data gets created but also /tmp/blah/ehcache_auto_created_<timestamp>/myCache.data. Persisted data goes into timestamped folder and the problem is that cached data can’t be reused across restarts. Also I see no point in general to have timestamped directory at all.

After few hours of debugging, I have found out that this comes from CacheManager.detectAndFixDiskStorePathConflict method. This method loops over ALL_CACHE_MANAGERS and checks if diskStorePath matches across. This results true (although there’s only one CacheManager in ALL_CACHE_MANAGERS in my case) and diskStorePath gets awkwardly renamed.

The log warning suggests to consider singleton CacheManager. My knowledge about cache managers isn’t deep but I have no intention of using more than one (especially with different settings). The only way I access net.sf.ehcache.CacheManager is via CacheManager.getInstance(), as suggested in the documentation.

Can anyone shed some light here? Is this a bug?

I am using Ehcache version 2.4.4.

Full stack trace:

main@1, prio=5, in group 'main', status: 'RUNNING'
  at net.sf.ehcache.CacheManager.detectAndFixDiskStorePathConflict(CacheManager.java:612)
  at net.sf.ehcache.CacheManager.configure(CacheManager.java:586)
  at net.sf.ehcache.CacheManager.init(CacheManager.java:359)
  at net.sf.ehcache.CacheManager.<init>(CacheManager.java:228)
  at net.sf.ehcache.hibernate.EhCacheRegionFactory.start(EhCacheRegionFactory.java:79)
  at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:250)
  at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385)
  ...

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:18:50+00:00Added an answer on May 25, 2026 at 11:18 am

    The problem was coming from the fact I have been using EhCacheRegionFactory in my hibernate bindings (the particular cache wasn’t related to Hibernate at all, but was defined on the same file).

    I have switched to SingletonEhCacheRegionFactory and the problem went away.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to use groovy for a little ftp script and found this post
I wanted to use the fluent interface in Castle Windsor. Since this isn't available
I wanted to use a native Dll in my C# .net application as this:
I wanted to use this gem: https://github.com/PRX/apn_on_rails Finally, after digging through the issues, seems
Subversion 1.5 introduced changelists and I wanted to use this feature to group a
I wanted to use a custom background for my UITextFields . This works fine
I wanted to use a switch statement. I ran into difficulties quickly. It looks
I wanted to use [StudyCompletionDate (0032,1050)] but since it is retired I would like
I just wanted to use grep with option -f FILE. This should make grep
I wanted to use T4 to generate properties for a partial class. I'm running

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.