• dubbo Can not lock the registry cache file


    使用dubbo 出现以下异常 要怎么处理诶;
    2016-01-22 09:27:06 WARN [com.alibaba.dubbo.registry.support.AbstractRegistry.doSaveProperties(AbstractRegistry.java:221)] - < [DUBBO] Failed to save registry store file, cause: Can not lock the registry cache file C:UsersAdministrator.dubbodubbo-registry-127.0.0.1.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: 127.0.0.1>
    java.io.IOException: Can not lock the registry cache file C:UsersAdministrator.dubbodubbo-registry-127.0.0.1.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)
    at com.alibaba.dubbo.registry.support.AbstractRegistry S a v e P r o p e r t i e s . r u n ( A b s t r a c t R e g i s t r y . j a v a : 150 ) a t j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r . r u n W o r k e r ( T h r e a d P o o l E x e c u t o r . j a v a : 1145 ) a t j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r SaveProperties.run(AbstractRegistry.java:150) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor SaveProperties.run(AbstractRegistry.java:150)atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)atjava.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
    2016-01-22 09:27:06 WARN [com.alibaba.dubbo.registry.support.AbstractRegistry.doSaveProperties(AbstractRegistry.java:221)] - < [DUBBO] Failed to save registry store file, cause: Can not lock the registry cache file C:UsersAdministrator.dubbodubbo-registry-127.0.0.1.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: 127.0.0.1>
    java.io.IOException: Can not lock the registry cache file C:UsersAdministrator.dubbodubbo-registry-127.0.0.1.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)
    at com.alibaba.dubbo.registry.support.AbstractRegistry S a v e P r o p e r t i e s . r u n ( A b s t r a c t R e g i s t r y . j a v a : 150 ) a t j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r . r u n W o r k e r ( T h r e a d P o o l E x e c u t o r . j a v a : 1145 ) a t j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r SaveProperties.run(AbstractRegistry.java:150) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor SaveProperties.run(AbstractRegistry.java:150)atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)atjava.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:615)

    at java.lang.Thread.run(Thread.java:745)

    当本地同时启动服务端和客户端的时候就可能产生这个问题。
    解决方案

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

    主要在启动脚本里面添加配置: -Ddubbo.registry.file=C:Usersdell.dubbodubbo-registry-192.168.1.62-junit.cache 文件名自己配置一个 -Ddubbo.registry.file=C:Usersdell.dubbodubbo-registry-192.168.1.62-junit.cache

  • 相关阅读:
    通过`spec.serviceAccountName`可以指定argo workflow pod运行时的serviceaccount
    解决合宙Esp32c3简约版不能Arduino ide开发的问题
    Goldengate
    前端周刊第二十九期
    大数据培训企业开发案例实时读取本地文件到HDFS案例
    动态代理之Cjlib的动态代理简单理解
    微软免费录屏软件——Free Screen Recorder Pro
    8月榜单丨飞瓜数据B站UP主排行榜(哔哩哔哩平台)发布!
    外贸增长背后的跨境电商转型路径
    Vue进阶(六十七)页面刷新路由传参丢失问题分析及解决
  • 原文地址:https://blog.csdn.net/m0_67265464/article/details/126654632