看一下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); } }
112024-03-02
相似问题