no available service 'default' found, please make sure registry config correct
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Ⅰ. Issue Description
seata客户端启动的时候,日志中报错no available service ‘default’ found, please make sure registry config correct。
Ⅱ. Describe what happened
seata服务端在虚拟机的docker中启动了,配置放在nacos,seata-server也注册进去了。
客户端配置如下:
If there is an exception, please attach the exception trace:
2020-04-09 09:28:37.527 INFO 20728 --- [ main] c.a.c.n.c.NacosPropertySourceBuilder : Loading nacos data, dataId: 'order-service.yaml', group: 'DEFAULT_GROUP'
2020-04-09 09:28:37.530 INFO 20728 --- [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='NACOS', propertySources=[NacosPropertySource {name='order-service.yaml'}]}
2020-04-09 09:28:37.533 INFO 20728 --- [ main] c.d.o.OrderServiceApplication : No active profile set, falling back to default profiles: default
2020-04-09 09:28:38.001 INFO 20728 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=f5c5f4c1-f03f-3300-8228-b6d9b71b8499
2020-04-09 09:28:38.016 INFO 20728 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'com.dashan.orderservice.feign.AccountFeign' of type [org.springframework.cloud.openfeign.FeignClientFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-04-09 09:28:38.034 INFO 20728 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.cloud.alibaba.seata-com.alibaba.cloud.seata.SeataProperties' of type [com.alibaba.cloud.seata.SeataProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-04-09 09:28:38.034 INFO 20728 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'com.alibaba.cloud.seata.GlobalTransactionAutoConfiguration' of type [com.alibaba.cloud.seata.GlobalTransactionAutoConfiguration$$EnhancerBySpringCGLIB$$8fbaeba5] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-04-09 09:28:38.055 INFO 20728 --- [ main] io.seata.config.FileConfiguration : The file name of the operation is registry.conf
2020-04-09 09:28:38.086 WARN 20728 --- [ main] io.seata.config.ConfigurationFactory : failed to load extConfiguration:not found service provider for : io.seata.config.ExtConfigurationProvider[null] and classloader : sun.misc.Launcher$AppClassLoader@18b4aac2
io.seata.common.loader.EnhancedServiceNotFoundException: not found service provider for : io.seata.config.ExtConfigurationProvider[null] and classloader : sun.misc.Launcher$AppClassLoader@18b4aac2
2020-04-09 09:28:38.096 INFO 20728 --- [ main] i.s.common.loader.EnhancedServiceLoader : load ConfigurationProvider[Nacos] extension by class[io.seata.config.nacos.NacosConfigurationProvider]
2020-04-09 09:28:38.111 INFO 20728 --- [ main] i.s.s.a.GlobalTransactionScanner : Initializing Global Transaction Clients ...
2020-04-09 09:28:38.264 INFO 20728 --- [ main] i.s.c.r.netty.AbstractRpcRemotingClient : RpcClientBootstrap has started
2020-04-09 09:28:38.265 INFO 20728 --- [ main] i.s.s.a.GlobalTransactionScanner : Transaction Manager Client is initialized. applicationId[order-service] txServiceGroup[order-service-seata-group]
2020-04-09 09:28:38.409 INFO 20728 --- [ main] io.seata.rm.datasource.AsyncWorker : Async Commit Buffer Limit: 10000
2020-04-09 09:28:38.458 INFO 20728 --- [ main] i.s.c.r.netty.AbstractRpcRemotingClient : RpcClientBootstrap has started
2020-04-09 09:28:38.458 INFO 20728 --- [ main] i.s.s.a.GlobalTransactionScanner : Resource Manager is initialized. applicationId[order-service] txServiceGroup[order-service-seata-group]
2020-04-09 09:28:38.458 INFO 20728 --- [ main] i.s.s.a.GlobalTransactionScanner : Global Transaction Clients are initialized.
2020-04-09 09:28:38.506 INFO 20728 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$28ee22a] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-04-09 09:28:38.580 INFO 20728 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'com.alibaba.cloud.seata.feign.SeataFeignClientAutoConfiguration$FeignBeanPostProcessorConfiguration' of type [com.alibaba.cloud.seata.feign.SeataFeignClientAutoConfiguration$FeignBeanPostProcessorConfiguration$$EnhancerBySpringCGLIB$$efa06af0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-04-09 09:28:38.583 INFO 20728 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'seataFeignObjectWrapper' of type [com.alibaba.cloud.seata.feign.SeataFeignObjectWrapper] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-04-09 09:28:38.716 INFO 20728 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.hibernate.validator.internal.constraintvalidators.bv.notempty.NotEmptyValidatorForCharSequence' of type [org.hibernate.validator.internal.constraintvalidators.bv.notempty.NotEmptyValidatorForCharSequence] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-04-09 09:28:38.720 INFO 20728 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.hibernate.validator.internal.constraintvalidators.bv.NotNullValidator' of type [org.hibernate.validator.internal.constraintvalidators.bv.NotNullValidator] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-04-09 09:28:38.740 INFO 20728 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.cloud.sentinel-com.alibaba.cloud.sentinel.SentinelProperties' of type [com.alibaba.cloud.sentinel.SentinelProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
INFO: log base dir is: C:\Users\whf\logs\csp\
INFO: log name use pid is: false
2020-04-09 09:28:38.825 INFO 20728 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'com.alibaba.cloud.sentinel.custom.SentinelAutoConfiguration' of type [com.alibaba.cloud.sentinel.custom.SentinelAutoConfiguration$$EnhancerBySpringCGLIB$$26365007] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-04-09 09:28:38.829 INFO 20728 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$1ea8e527] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-04-09 09:28:39.057 INFO 20728 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9020 (http)
2020-04-09 09:28:39.075 INFO 20728 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-04-09 09:28:39.075 INFO 20728 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.17]
2020-04-09 09:28:39.210 INFO 20728 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-04-09 09:28:39.210 INFO 20728 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1661 ms
2020-04-09 09:28:39.219 INFO 20728 --- [ main] c.a.c.s.SentinelWebAutoConfiguration : [Sentinel Starter] register Sentinel CommonFilter with urlPatterns: [/*].
2020-04-09 09:28:39.467 INFO 20728 --- [ main] c.a.d.s.b.a.DruidDataSourceAutoConfigure : Init DruidDataSource
2020-04-09 09:28:39.583 INFO 20728 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} inited
2020-04-09 09:28:39.596 INFO 20728 --- [ main] s.s.a.d.SeataDataSourceBeanPostProcessor : Auto proxy of [dataSource]
2020-04-09 09:28:39.759 INFO 20728 --- [ main] i.s.common.loader.EnhancedServiceLoader : load DbTypeParser[druid] extension by class[io.seata.sqlparser.druid.DruidDelegatingDbTypeParser]
2020-04-09 09:28:39.766 INFO 20728 --- [ main] i.s.common.loader.EnhancedServiceLoader : load RegistryProvider[Nacos] extension by class[io.seata.discovery.registry.nacos.NacosRegistryProvider]
2020-04-09 09:28:39.974 ERROR 20728 --- [ main] i.s.c.r.netty.NettyClientChannelManager : no available service 'default' found, please make sure registry config correct
2020-04-09 09:28:40.150 INFO 20728 --- [ main] i.s.s.a.GlobalTransactionScanner : Bean[com.dashan.orderservice.service.impl.BaseOrderServiceImpl] with name [baseOrderServiceImpl] would use interceptor [io.seata.spring.annotation.GlobalTransactionalInterceptor]
2020-04-09 09:28:40.168 WARN 20728 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2020-04-09 09:28:40.168 INFO 20728 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2020-04-09 09:28:40.171 WARN 20728 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2020-04-09 09:28:40.171 INFO 20728 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2020-04-09 09:28:40.290 INFO 20728 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-04-09 09:28:41.969 INFO 20728 --- [ main] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname
2020-04-09 09:28:41.982 INFO 20728 --- [ main] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService
2020-04-09 09:28:43.725 INFO 20728 --- [ main] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname
2020-04-09 09:28:43.792 WARN 20728 --- [ main] c.a.c.s.d.converter.SentinelConverter : converter can not convert rules because source is empty
2020-04-09 09:28:43.853 INFO 20728 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 9020 (http) with context path ''
2020-04-09 09:28:43.881 INFO 20728 --- [ main] c.a.c.n.registry.NacosServiceRegistry : nacos registry, order-service 192.168.10.1:9020 register finished
2020-04-09 09:28:43.883 INFO 20728 --- [ main] c.d.o.OrderServiceApplication : Started OrderServiceApplication in 10.317 seconds (JVM running for 11.277)
Ⅲ. Describe what you expected to happen
Ⅳ. How to reproduce it (as minimally and precisely as possible)
- seata-server使用1.1.0版本,seata-client使用spring-cloud-alibaba-seata并替换seata-all为1.1.0版本
- seata-server在虚拟机中使用docker-compose部署,再此之前已启动mysql和nacos:
version: "3"
services:
seata:
image: seataio/seata-server:latest
container_name: seata
ports:
- "8091:8091"
environment:
- SEATA_CONFIG_NAME=file:/root/conf/registry
- SEATA_IP=192.168.10.130
- SEATA_MODE=file
- SEATA_PORT=8091
volumes:
- /app/cloud/seata/conf:/root/conf
- /app/cloud/seata/logs:/root/logs
restart: always
- seata-server的register配置如下:
registry {
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type = "nacos"
nacos {
serverAddr = "192.168.10.130"
namespace = ""
cluster = "default"
}
eureka {
serviceUrl = "http://localhost:8761/eureka"
application = "default"
weight = "1"
}
redis {
serverAddr = "localhost:6379"
db = "0"
}
zk {
cluster = "default"
serverAddr = "127.0.0.1:2181"
sessionTimeout = 6000
connectTimeout = 2000
username = ""
password = ""
}
consul {
cluster = "default"
serverAddr = "127.0.0.1:8500"
}
etcd3 {
cluster = "default"
serverAddr = "http://localhost:2379"
}
sofa {
serverAddr = "127.0.0.1:9603"
application = "default"
region = "DEFAULT_ZONE"
datacenter = "DefaultDataCenter"
cluster = "default"
group = "SEATA_GROUP"
addressWaitTime = "3000"
}
file {
name = "file.conf"
}
}
config {
# file、nacos 、apollo、zk、consul、etcd3
type = "nacos"
nacos {
serverAddr = "192.168.10.130:8848"
namespace = "7f0657a8-8986-4075-8d03-0a6afc292c16"
group = "SEATA_GROUP"
}
consul {
serverAddr = "127.0.0.1:8500"
}
apollo {
appId = "seata-server"
apolloMeta = "http://192.168.1.204:8801"
namespace = "application"
}
zk {
serverAddr = "127.0.0.1:2181"
sessionTimeout = 6000
connectTimeout = 2000
username = ""
password = ""
}
etcd3 {
serverAddr = "http://localhost:2379"
}
file {
name = "file.conf"
}
}
- seata-client的配置的截图贴在上面了,我能确定我的service.vgroupMapping没配置错。
Ⅴ. Anything else we need to know?
经过Debug,最终确认异常是由NacosRegistryServiceImpl.lookup(String key)方法出来的,在此类中有两个成员变量LISTENER_SERVICE_MAP和CLUSTER_ADDRESS_MAP,在第一次执行lookup方法的时候,List<Instance> firstAllInstances = getNamingInstance().getAllInstances(“serverAddr”, clusters);这行代码的clusters只有一个元素,就是我配置的"default",但是返回出来的firstAllInstances是一个空集合,所以执行完后CLUSTER_ADDRESS_MAP里面有一个键值对,键为"default",值为空集合;而LISTENER_SERVICE_MAP会在执行subscribe方法的时候保存一个键值对,,键为"default",值为空集合,这样下次执行的时候,if (!LISTENER_SERVICE_MAP.containsKey(clusterName))这个判断就过不了了(就算过了也是一样);而lookup方法的返回值(List)CLUSTER_ADDRESS_MAP.get(clusterName);,所以返回出来的也是空集合。
所以NettyClientChannelManager.getAvailServerList(String transactionServiceGroup)方法中返回出来的也是空集合,然后抛出异常。
Ⅵ. Environment:
- JDK version : 1.8
- OS : seata-server: centos7 seata-client: windows10
- Others: seata 1.1.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:35 (4 by maintainers)
我真是一万只草泥马飞奔而过,就在快下班的时候,竟然可以了 !!! 就是这个配置问题,我用的 seata 1.4.0。使用的是官网给的Demo 。
我深入分析了下是因为我在 registry 配置里面没有设置 group, 而config 里面的 group 可以不设置。同时config里面的type及file不用设置,否则报错。最终的配置是:
最后划重点:
最后我想说,官网给的文档很用心,但是,不好意思,真的很乱。。。就拿分组来说,本来可以使用代码或其他方式简洁表达的,非要写一堆文字,搞得反而不懂取到分组后,集群名称又是怎么取… 就这些吧,为解决这个问题专注了一天,我是真的饿了… -_- …
我也出现过这个问题,是因为seata服务端与客户端版本不匹配造成的,seata1.4.0,后来客户端用spring-cloud-starter-alibaba-seata:2.2.2.RELEASE就好了。但这个客户端,配置方式可能不同,我是把flie.conf,registry.conf都整合到yml中。