• Dubbo java.io.IOException: Can not lock the registry cache file


    跑单测用例的时候,以前执行成功的用例,运行时控制台仍然会报 dubbo 相关的错误:

    Failed to save registry store file, cause: Can not lock the registry cache file

    2016-03-22 17:16:05,493 [DubboSaveRegistryCache-thread-1] WARN  com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry -  [DUBBO] Failed to save registry store file, cause: Can not lock the registry cache file /Users/baidu/.dubbo/dubbo-registry-1*.9*.3*.3*.cache, ignore and retry later, maybe multi java process use the file, please config: dubbo.registry.file=xxx.properties, dubbo version: 2.5.3, current host: 1*.9*.3*.3*.

    java.io.IOException: Can not lock the registry cache file /Users/baidu/.dubbo/dubbo-registry-1*.9*.3*.3*.cache, ignore and retry later, maybe multi java process use the file, please config: dubbo.registry.file=xxx.properties

        at com.alibaba.dubbo.registry.support.AbstractRegistry.doSaveProperties(AbstractRegistry.java:193) ~[dubbo-2.5.3.jar:2.5.3]

        at com.alibaba.dubbo.registry.support.AbstractRegistry$SaveProperties.run(AbstractRegistry.java:150) [dubbo-2.5.3.jar:2.5.3]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_79]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_79]

        at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79]

    Dubbo在保存服务列表时失败,Can not lock the registry cache file /Users/baidu/.dubbo/dubbo-registry-1*.9*.3*.3*.cache,拿不到文件锁,无法保存服务列表。

     Dubbo通过注册中心发现服务,发现的服务Dubbo同时也会保存到本地缓存一份,缓存的好处有很多,比如不需要每次使用的时候都通过注册中心获取,注册中心不可用了,不影响消费端的调用,因为本地缓存了一份服务提供者列表。Dubbo本地缓存默认采用的文件,会根据注册中心自动在当前用户目录下生成一个缓存文件,类似/home/newad/.dubbo/dubbo-registry-*.*.*.*.cache,星号表示注册中心的IP地址,当同一台机器上同时启动多个进程,就会出现多个进程争夺此文件的写入权限,觖此问题的方法也很简单,日志里面都说了重新配置一下这个缓存文件就可以了。

    我的解决办法是进入到目录:/Users/baidu/.dubbo/ 下,把文件重新命名一下,或者删除,就可以了。

     

  • 相关阅读:
    《梦段代码》阅读笔记03
    用户场景
    冲刺!
    冲刺!
    周总结8
    冲刺!
    冲刺!
    PMS权限管理和鉴权过程
    PMS构造函数以及apk如何扫描
    PMS的学习之旅
  • 原文地址:https://www.cnblogs.com/sonofelice/p/5307790.html
Copyright © 2020-2023  润新知