question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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也注册进去了。 image image 客户端配置如下: image image image image

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)

  1. seata-server使用1.1.0版本,seata-client使用spring-cloud-alibaba-seata并替换seata-all为1.1.0版本
  2. 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
  1. 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"
  }
}
  1. 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)方法中返回出来的也是空集合,然后抛出异常。 image

Ⅵ. Environment:

  • JDK version : 1.8
  • OS : seata-server: centos7 seata-client: windows10
  • Others: seata 1.1.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:35 (4 by maintainers)

github_iconTop GitHub Comments

10reactions
linkypicommented, Nov 4, 2020

找到原因了 NacosRegistryServiceImpl 的 getNacosUserName 和 getNacosPassword 应该是写错了,应该是 registry,写成 config 了

seata:
  application-id: ${spring.application.name}
  tx-service-group: good_service_tx_group
  service:
    vgroup-mapping:
      good_service_tx_group: default
  registry:
    type: nacos
    nacos:
      server-addr: ${spring.cloud.nacos.discovery.server-addr}
      username: ${spring.cloud.nacos.discovery.username}
      password: ${spring.cloud.nacos.discovery.password}

改为

seata:
  application-id: ${spring.application.name}
  tx-service-group: good_service_tx_group
  service:
    vgroup-mapping:
      good_service_tx_group: default
  config:
    nacos:
      username: ${spring.cloud.nacos.discovery.username}
      password: ${spring.cloud.nacos.discovery.password}
  registry:
    type: nacos
    nacos:
      server-addr: ${spring.cloud.nacos.discovery.server-addr}

我真是一万只草泥马飞奔而过,就在快下班的时候,竟然可以了 !!! 就是这个配置问题,我用的 seata 1.4.0。使用的是官网给的Demo 。 image 我深入分析了下是因为我在 registry 配置里面没有设置 group, 而config 里面的 group 可以不设置。同时config里面的type及file不用设置,否则报错。最终的配置是:

seata:
  enabled: true
  data-source-proxy-mode: AT
  application-id: account-seata-example
  tx-service-group: my_test_tx_group # 事务群组(可以每个应用独立取名,也可以使用相同的名字)
  enable-auto-data-source-proxy: true
  use-jdk-proxy: false
  client:
    rm:
      report-success-enable: true
      table-meta-check-enable: false # 自动刷新缓存中的表结构(默认false)
      report-retry-count: 5 # 一阶段结果上报TC重试次数(默认5)
      async-commit-buffer-limit: 10000 # 异步提交缓存队列长度(默认10000)
      lock:
        retry-interval: 10 # 校验或占用全局锁重试间隔(默认10ms)
        retry-times:    30 # 校验或占用全局锁重试次数(默认30)
        retry-policy-branch-rollback-on-conflict: true # 分支事务与其它全局回滚事务冲突时锁策略(优先释放本地锁让回滚成功)
    tm:
      commit-retry-count:   3 # 一阶段全局提交结果上报TC重试次数(默认1次,建议大于1)
      rollback-retry-count: 3 # 一阶段全局回滚结果上报TC重试次数(默认1次,建议大于1)
      degrade-check: false
      degrade-check-period: 2000
      degrade-check-allow-times: 10
    undo:
      data-validation: true # 二阶段回滚镜像校验(默认true开启)
      log-serialization: jackson # undo序列化方式(默认jackson)
      log-table: undo_log  # 自定义undo表名(默认undo_log)
    log:
      exceptionRate: 100 # 日志异常输出概率(默认100)

  service:
    vgroupMapping:
      my_test_tx_group: default  # TC 集群(必须与seata-server保持一致)
    enable-degrade: false # 降级开关
    disable-global-transaction: false # 禁用全局事务(默认false)
    grouplist:
      default: 127.0.0.1:8091
  transport:
    shutdown:
      wait: 3
    thread-factory:
      boss-thread-prefix: NettyBoss
      worker-thread-prefix: NettyServerNIOWorker
      server-executor-thread-prefix: NettyServerBizHandler
      share-boss-worker: false
      client-selector-thread-prefix: NettyClientSelector
      client-selector-thread-size: 1
      client-worker-thread-prefix: NettyClientWorkerThread
    type: TCP
    server: NIO
    heartbeat: true
    serialization: seata
    compressor: none
    enable-client-batch-send-request: true # 客户端事务消息请求是否批量合并发送(默认true)
  registry:
    type: nacos
    nacos:
      server-addr: localhost:8848
      namespace:
      group: DEFAULT_GROUP
      cluster: default
  config:
#    file:  # 使用 nacos 后就不能打开,否则报错
#      name: file.conf
#    type: nacos  # 不能打开,否则报错,有可能是新版已经没有该配置
    nacos:
      namespace:
      server-addr: localhost:8848
      group: DEFAULT_GROUP

最后划重点:

  • registry及config 的 group分组必须与seata服务端(即TC)中的group保持一致,seata服务端默认是 SEATA_GROUP, 我使用的是 DEFAULT_GROUP, 具体配置见下图
  • 分组名称及其对应的集群名称必须保持一致,见下图
  • 如果有使用注册中心,请按照 配置将配置先导入注册中心再启动注册中心。
  • vgroup-mapping 命名改为驼峰命名 vgroupMapping,貌似是从1.2.0开始

最后我想说,官网给的文档很用心,但是,不好意思,真的很乱。。。就拿分组来说,本来可以使用代码或其他方式简洁表达的,非要写一堆文字,搞得反而不懂取到分组后,集群名称又是怎么取… 就这些吧,为解决这个问题专注了一天,我是真的饿了… -_- …

image image

5reactions
tzs199373commented, Dec 4, 2020

我也出现过这个问题,是因为seata服务端与客户端版本不匹配造成的,seata1.4.0,后来客户端用spring-cloud-starter-alibaba-seata:2.2.2.RELEASE就好了。但这个客户端,配置方式可能不同,我是把flie.conf,registry.conf都整合到yml中。

Read more comments on GitHub >

github_iconTop Results From Across the Web

【seata1.3.0】no available service 'default' found, please ...
no available service 'default' found, please make sure registry config correct. 原因及解决方案:参考seata官方FAQ(Frequently asked questions) ...
Read more >
no available service 'default' found · Issue #I23Y4P - Gitee
我把你项目跑起来后发现一个错误: no available service 'default' found, please make sure registry config correct。...
Read more >
seata: no available service 'null' found, please make sure ...
seata: no available service 'null' found, please make sure registry config correct - CodeAntenna.
Read more >
关于seata no available service 'null' found, please make sure ...
今天在使用seata时,启动一直报错. no available service 'null' found, please make sure registry config correct. 在检查了nacos的配置中心和服务 ...
Read more >
夏心07的博客-程序员宅基地
NettyClientChannelManager : no available service 'default' found, please make sure registry config correct. 原因及解决方案:参考seata官方FAQ(Frequently ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found