May 22, 2011
Posted by on
I recently updated ehcache from 2.3.0 to 2.4.2. Everything seemed to work fine, but one cache was throwing the error “Could not create cache directory” and the location was in the bin directory of my app server. Suspiciously, this is the default path when an empty path is given as the disk store location. This cache is a little unusual in it’s configuration as it loads an xml config file for the cache manager settings and then programmatically adds a cache to this cache manager. The xml file has the disk store path and the cache constructor sets the disk store parameter to “”.
In 2.3.0 this would allow the cache to inherit the disk sore in the xml cache manager config, but in 2.4.2 you must set the disk store parameter in null to have the same effect. I couldn’t find this noted anywhere so I though I’d post it here in case you hit the same pot hole on the road to cache happiness.
This upgrade was part of heading towards using Terracotta to cluster application (via the caches) and while everything is hanging together so far, the cluster’s performance needs some tuning.