EHC ❯ Cache: Could not create disk store. Initial cause was null
-
Bug
-
Status: Closed
-
2 Major
-
Resolution: Fixed
-
ehcache-core
-
-
hsingh
-
Reporter: hsingh
-
November 05, 2009
-
0
-
Watchers: 0
-
January 17, 2013
-
November 06, 2009
Attachments
Description
Get following exception on setting diskStorePath
Creating cache …
Disk Store: C:\DOCUME~1\hsingh\LOCALS~1\Temp\
isDirectory : true
canWrite : true
isAbsolute : true
Exception in thread “main” net.sf.ehcache.CacheException: regionNameCache: Could not create disk store. Initial cause was null
at net.sf.ehcache.store.DiskStore.
Comments
gluck 2009-11-05
Himadri Singh 2009-11-06
Not sure how do we set diskStore in ehcache.xml but through java adding DiskStoreConfiguration to cache manager config makes it work fine without any exceptions.
DiskStoreConfiguration diskStoreConfigurationParameter = new DiskStoreConfiguration();
String diskStore = System.getProperty("java.io.tmpdir") + "/"+ cacheManagerName;
diskStoreConfigurationParameter.setPath(diskStore);
config.addDiskStore(diskStoreConfigurationParameter);
Chris Dennis 2009-11-06
Resolved by changing the log message to be as Greg suggested. Also added test coverage to CacheManagerTest to ensure this fails correctly.
Himadri Singh 2009-11-16
New message
Exception in thread “main” net.sf.ehcache.CacheException: regionNameCache: Could not create disk store. Initial cause was regionName Cache: Could not create disk store. This CacheManager configuration does not allow creation of DiskStores. If you wish to create DiskStores, please configure a diskStore path.
at net.sf.ehcache.store.DiskStore.
There are quite a few people who want to use ehcache memory only. Disk paths if used need to be unique. We have an autoresolver but that issues a warning which also disturbs people. Some use cases: more than one CacheManager in a VM and a company that is deploying multiple applications on one server. or running n ASP app where they have lots of instances on one server. This tends to be a deployment issue.
If a CacheManager is configured not to have a disk path we should not permit creating of caches with disk stores. So I think the current behaviour is intended and important.
Looking at the stack trace
Exception in thread “main” net.sf.ehcache.CacheException: regionNameCache: Could not create disk store. Initial cause was null
we should change it so that it says:
regionNameCache: Could not create disk store. This CacheManager configuration does not allow creation of DiskStores. If you wish to create DiskStores, please configure a diskStore path.