看一下dubbo启动报错

来源:3-7 -2 Dubbo实战讲解

瓦坎达佛爱我

2024-03-02

org.apache.dubbo.common.cache.FileCacheStoreFactory$PathNotExclusiveException: C:\Users\Administrator.dubbo.metadata.qiyu-live-user-application.nacos.116.62.213.112%003a8848.dubbo.cache is not exclusive.
Maybe multiple Dubbo instances are using the same folder.

写回答

1回答

瓦坎达佛爱我

提问者

2024-03-02

dubbo的默认缓存文件是在{user.home}/.dubbo/目录下,默认会跟进提供者和消费者生成一些文件。如果在同一台机器上运行多个dubbo项目,则会报此错误。解决办法是在SpringBoot启动类中加入如下代码,修改dubbo的缓存文件为jar包所在的位置:

@SpringBootApplication
public class ServiceUserApplication {

    public static void main(String[] args) {

        ApplicationHome home = new ApplicationHome(ServiceUserApplication.class);
        File jarFile = home.getSource();
        String dirPath = jarFile.getParentFile().toString();
        String filePath = dirPath + File.separator + ".dubbo";
        System.out.println(filePath);

        System.setProperty("dubbo.meta.cache.filePath", filePath);
        System.setProperty("dubbo.mapping.cache.filePath",filePath);

        SpringApplication.run(ServiceUserApplication.class, args);
    }
}




1
1
Danny_Idea
强👍👍👍👍
2024-03-02
共1条回复

SpringCloudAlibaba高并发仿斗鱼直播平台实战

SpringCloudAlibaba高并发仿斗鱼直播平台实战

421 学习 · 344 问题

查看课程