feature request #5848
Problem with writing ehCache folder on network drive using UNC path (net.sf.ehcache.CacheException)
When a user has its home folder set to a network drive the creation of the data model fails (Right-click in data source view->Create data model)
The ehCache folder is set in
cdmlib-remote/src/main/resources/eu/etaxonomy/cdm/remote/ehcache.xml it uses the java property
<diskStore path="user.home/.cdm-server-ehcache" />
In contrast to that the .cdmLibrary is created correctly on the network drive.
When setting the
-Duser.home parameter to a local path with write permission when launching the editor everything works fine.
see also #3580
Ben had this problem. see stack trace below
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'taxonOaiPmhController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void eu.etaxonomy.cdm.remote.controller.oaipmh.AbstractOaiPmhController.setCacheProviderFacade(org.springmodules.cache.provider.CacheProviderFacade); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheProviderFacade' defined in class path resource [eu/etaxonomy/cdm/remote.xml]: Cannot resolve reference to bean 'cacheManager' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheManager' defined in class path resource [eu/etaxonomy/cdm/remote.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Disk store path can't be created: \nwz.wwu.de\dfs\home\b\bstoe_01\.cdm-server-ehcache
#2 Updated by Ben Stöver over 2 years ago
- Subject changed from Problem with writing ehCache folder on network drive (net.sf.ehcache.CacheException) to Problem with writing ehCache folder on network drive using UNC path (net.sf.ehcache.CacheException)
As far as I figured that out the problem is not related to using network or local folders but to the usage of UNC paths (which start with "\").
In my environment the Java system property "user.home" is set to "\nwz.wwu.de\dfs\home\b\bstoe_01\", but in the error message in the stack trace above the first "\" is missing. If I start the editor with the option "-Duser.home=I:\" everything works fine. ("I" in this case is a network drive that links to the exactly the same location "\nwz.wwu.de\dfs\home\b\bstoe_01\".)
The problem really seems to be the missing first "\". Maybe it got lost somewhere on the way because the first "\" was interpreted as the Java escape character. It could also be that the path was stored in a Java class that is not capable of handling UNC paths. (I remember that e.g. java.net.URI had such problems, but I'm not completely sure.)
#7 Updated by Ben Stöver almost 2 years ago
Patrick merged the current code into my branch and I tested it. I currently always run the EDITor with the option "-Duser.home=I:\" as described above. If I remove this option and start the EDITor with the current code version, I do not see any of my databases anymore in the "Connections" view and I cannot create new databases. The errors in the attached text file occur.
As far as I can see that, the bug still exists and was not solved together with #2939.
#8 Updated by Andreas Kohlbecker almost 2 years ago
- Category changed from cdmlib-remote to cdmlib
- Status changed from Resolved to Feedback
- Assignee changed from Patrick Plitzner to Ben Stöver
This issue seems to be related to a java bug which existed in java versions pre jdk 1.8: https://duckduckgo.com/?q=System.getProperty(%22user.home%22)+network+drive&t=canonical&ia=web
The user home folder is determined by the utility class
static final String userHome = System.getProperty("user.home");
Please can you compare your specific situation with the ones described in the various stack overflow post and on other pages? So we could get a clear idea of what is going wrong.
#9 Updated by Ben Stöver almost 2 years ago
I tested it again and it now uses "C:\Users\bstoe_01" as the user profile path. This is a local copy of the profile which should (to some extend) be synchronized with the server profile, when logging off. This depends on the configuration of the domain and often does not work properly.
Currently there is no error, when I create a new database, although I still do not see my databases from the network profile (because they are in I and not on C). (I don't know why I had a different result yesterday. Maybe due to the recent switch between Java 7 and 8. I was having some problems to make Eclipse to forget about the alternative JRE 7 I needed to use before.)
I checked the values of the windows variable %USERPROFILE% which also links to "C:\Users\bstoe_01". So from a formal point of view, everything should be fine now, but in practice a lot of problems remain, when working with profiles on network drives. (Here I will lose all my databases with each login now.)
I do not think, we can do much about this in the EDITor, but it would be worth mentioning to use an option like "-Duser.home=I:\" if the user profile is on a network drive in some documentation file of the EDITor. It will keep users in such environments from a lot of trouble. Do you have any idea, where this could be done?
(When creating a new database on C the following error occurred a number of times: "ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] - Specified key was too long; max key length is 1000 bytes". This is probably not related here?)
#11 Updated by Andreas Kohlbecker almost 2 years ago
Thank you Ben for this analysis.
I fully agree, we cant do much about this exept providing good documentation for users which are facing this problem: #6421
The "Specified key was too long" error is for sure something completely different. I will also create a new ticket for this: #6422
I think this ticket here can be closed now, does everybody agree?