spring boot 2.6.6 nacos 2.0.4 dubbo 3.0.7
provider启动正常 consumer启动时报如下错误:
2022-04-03 16:27:28.360 INFO 33240 --- [ main] o.a.d.c.cache.FileCacheStoreFactory : [DUBBO] Failed to create file store cache. Local file cache will be disabled. Cache file name: C:\Users\liguo.dubbo.metadata.nacos127.0.0.1%003a8848.dubbo.cache, dubbo version: 3.0.7, current host: 192.168.137.1
org.apache.dubbo.common.cache.FileCacheStoreFactory$PathNotExclusiveException: C:\Users\liguo.dubbo.metadata.nacos127.0.0.1%003a8848.dubbo.cache is not exclusive. at org.apache.dubbo.common.cache.FileCacheStoreFactory.tryFileLock(FileCacheStoreFactory.java:149) [dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.common.cache.FileCacheStoreFactory.getFile(FileCacheStoreFactory.java:115) [dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.common.cache.FileCacheStoreFactory.lambda$getInstance$0(FileCacheStoreFactory.java:82) [dubbo-3.0.7.jar:3.0.7] at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[na:1.8.0_311] at org.apache.dubbo.common.cache.FileCacheStoreFactory.getInstance(FileCacheStoreFactory.java:82) [dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.metadata.AbstractCacheManager.init(AbstractCacheManager.java:47) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.client.metadata.store.MetaCacheManager.(MetaCacheManager.java:59) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.client.AbstractServiceDiscovery.(AbstractServiceDiscovery.java:85) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.client.AbstractServiceDiscovery.(AbstractServiceDiscovery.java:66) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.nacos.NacosServiceDiscovery.(NacosServiceDiscovery.java:59) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.nacos.NacosServiceDiscoveryFactory.createDiscovery(NacosServiceDiscoveryFactory.java:27) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.client.AbstractServiceDiscoveryFactory.lambda$getServiceDiscovery$0(AbstractServiceDiscoveryFactory.java:53) ~[dubbo-3.0.7.jar:3.0.7] at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[na:1.8.0_311] at org.apache.dubbo.registry.client.AbstractServiceDiscoveryFactory.getServiceDiscovery(AbstractServiceDiscoveryFactory.java:53) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.getServiceDiscovery(ServiceDiscoveryRegistry.java:122) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.createServiceDiscovery(ServiceDiscoveryRegistry.java:109) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.(ServiceDiscoveryRegistry.java:86) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.client.ServiceDiscoveryRegistryFactory.createRegistry(ServiceDiscoveryRegistryFactory.java:35) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.support.AbstractRegistryFactory.getRegistry(AbstractRegistryFactory.java:89) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.RegistryFactoryWrapper.getRegistry(RegistryFactoryWrapper.java:33) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.RegistryFactory$Adaptive.getRegistry(RegistryFactory$Adaptive.java) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.integration.RegistryProtocol.getRegistry(RegistryProtocol.java:393) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.integration.InterfaceCompatibleRegistryProtocol.getServiceDiscoveryInvoker(InterfaceCompatibleRegistryProtocol.java:63) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.client.migration.MigrationInvoker.refreshServiceDiscoveryInvoker(MigrationInvoker.java:428) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.client.migration.MigrationInvoker.migrateToApplicationFirstInvoker(MigrationInvoker.java:244) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.client.migration.MigrationRuleHandler.refreshInvoker(MigrationRuleHandler.java:73) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.client.migration.MigrationRuleHandler.doMigrate(MigrationRuleHandler.java:57) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.client.migration.MigrationRuleListener.onRefer(MigrationRuleListener.java:243) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.integration.RegistryProtocol.interceptInvoker(RegistryProtocol.java:535) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.integration.RegistryProtocol.doRefer(RegistryProtocol.java:505) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.registry.integration.RegistryProtocol.refer(RegistryProtocol.java:487) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.qos.protocol.QosProtocolWrapper.refer(QosProtocolWrapper.java:83) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:74) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.rpc.cluster.filter.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:71) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.rpc.protocol.ProtocolSerializationWrapper.refer(ProtocolSerializationWrapper.java:52) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.rpc.Protocol$Adaptive.refer(Protocol$Adaptive.java) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.config.ReferenceConfig.createInvokerForRemote(ReferenceConfig.java:494) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:397) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:285) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:219) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.config.utils.SimpleReferenceCache.get(SimpleReferenceCache.java:110) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.config.deploy.DefaultModuleDeployer.lambda$referServices$6(DefaultModuleDeployer.java:387) ~[dubbo-3.0.7.jar:3.0.7] at java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4707) ~[na:1.8.0_311] at org.apache.dubbo.config.deploy.DefaultModuleDeployer.referServices(DefaultModuleDeployer.java:367) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.config.deploy.DefaultModuleDeployer.start(DefaultModuleDeployer.java:154) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onContextRefreshedEvent(DubboDeployApplicationListener.java:111) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onApplicationEvent(DubboDeployApplicationListener.java:100) ~[dubbo-3.0.7.jar:3.0.7] at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onApplicationEvent(DubboDeployApplicationListener.java:45) ~[dubbo-3.0.7.jar:3.0.7] at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-5.3.18.jar:5.3.18] at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-5.3.18.jar:5.3.18] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-5.3.18.jar:5.3.18] at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421) ~[spring-context-5.3.18.jar:5.3.18] at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378) ~[spring-context-5.3.18.jar:5.3.18] at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:938) ~[spring-context-5.3.18.jar:5.3.18] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.18.jar:5.3.18] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.6.jar:2.6.6] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740) ~[spring-boot-2.6.6.jar:2.6.6] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415) ~[spring-boot-2.6.6.jar:2.6.6] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-2.6.6.jar:2.6.6] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312) ~[spring-boot-2.6.6.jar:2.6.6] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.6.jar:2.6.6] at org.liguo.dubbo.consumer.ConsumerApplication.main(ConsumerApplication.java:13) ~[classes/:na]
dubbo 3.0.5 没有这样的问题!
原提问者GitHub用户xtuul
通过查看源码做如下配置,修改他的缓存存储目录 dubbo.mapping.cache.filePath
下面这段是源码 public MappingCacheManager(String name, ScheduledExecutorService executorService) { String filePath = System.getProperty("dubbo.mapping.cache.filePath"); String fileName = System.getProperty("dubbo.mapping.cache.fileName"); if (StringUtils.isEmpty(fileName)) { fileName = DEFAULT_FILE_NAME; }
if (StringUtils.isNotEmpty(name)) {
fileName = fileName + "." + name;
}
String rawEntrySize = System.getProperty("dubbo.mapping.cache.entrySize");
int entrySize = StringUtils.parseInteger(rawEntrySize);
entrySize = (entrySize == 0 ? DEFAULT_ENTRY_SIZE : entrySize);
String rawMaxFileSize = System.getProperty("dubbo.mapping.cache.maxFileSize");
long maxFileSize = StringUtils.parseLong(rawMaxFileSize);
init(filePath, fileName, entrySize, maxFileSize, 50, executorService);
}
原回答者GitHub用户chiangho
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。