Reproduced from: http://blog.csdn.net/top_code/article/details/52279072
Start the Dubbo service when the error, the exception information is as follows:
2016-08-22 16:44:40.588 | dubbosaveregistrycache-thread-1 | WARN | Com.alibaba.dubbo.common.logger.log4j.Log4jLogger:Log4jLogger.java (78) | [Dubbo] Failed to save registry store file, Cause:can not lock the registry cache file/root/.dubbo/dubbo-registry-10.141.4.168.c Ache, ignore and retry later, maybe multi Java process use the file, please config:dubbo.registry.file=xxx.properties, du Bbo version:2.8.3, current host:127.0.0.1 Java.io.IOException:Can not lock the registry cache File/root/.dubbo/dubbo-r Egistry-10.141.4.168.cache, ignore and retry later, maybe multi Java process use the file, please CONFIG:DUBBO.REGISTRY.F Ile=xxx.properties at Com.alibaba.dubbo.registry.support.AbstractRegistry.doSaveProperties (Abstractregistry.java : 193) ~[dubbo-2.8.3.jar:2.8.3] at Com.alibaba.dubbo.registry.support.abstractregistry$saveproperties.run (Abstract REGISTRY.JAVA:150) [dubbo-2.8.3.jar:2.8.3] at Java.util.concurrent.ThreadPoolExecutor.runWorker (Threadpoolexecutor.java:1145) [na:1.7.0_60] at Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:615) [NA: 1.7.0_60] at Java.lang.Thread.run (thread.java:745) [na:1.7.0_60]
1 2 3 4 5 6 7 1 2 3 4 5 6-7
The general meaning of the error is that Dubbo failed to save the list of services, Can not lock the registry cache file/root/.dubbo/ Dubbo-registry-10.141.4.168.cache, unable to save the list of services, cannot get the file lock. cause of the error
The reason for this is that when the service registers with ZK, it caches the consumer list and writes user.home/.dubbo/dubbo-registry-"+ url.gethost () +". Cache this file, When multiple provider are started on the same machine, there is a problem with file lock contention, which is reported above. Solutions
Since it is due to competitive file locks, then let the service modules cache their own cached files can avoid such a problem.
Add file= "${catalina.home}/dubbo-registry/dubbo-registry.properties" to the provider XML configuration file as follows:
<dubbo:registry id= "Zkcenter" protocol= "Zookeeper" address= "${dubbo.zk_address" "file=" ${catalina.home}/ Dubbo-registry/dubbo-registry.properties "/>
1 1
This will be in the Catalina.home directory generated dubbo-registry this directory, cache file on the slow existence of this inside. reference materials
Abstractregistry Lock PROBLEM:HTTPS://GITHUB.COM/ALIBABA/DUBBO/ISSUES/81
Provider: Service provider