奇奇奇奇怪, 2021-06-08 16:22 采纳率: 50%
浏览 6906

微服务工程,nacos启动之后,启动项目的网关,报错

16:09:22.005 [main] WARN  c.a.n.c.c.NacosConfigService - [getConfigInner,173] - [config_rpc_client] [get-config] get from server error, dataId=sentinel-ruoyi-gateway, group=DEFAULT_GROUP, tenant=, msg=ErrCode:-401, ErrMsg:Client not connected,current status:STARTING
16:09:22.006 [main] WARN  c.a.n.c.c.NacosConfigService - [getConfigInner,177] - [config_rpc_client] [get-config] get snapshot ok, dataId=sentinel-ruoyi-gateway, group=DEFAULT_GROUP, tenant=, config=
16:09:22.007 [main] WARN  c.a.c.s.d.c.SentinelConverter - [convert,80] - converter can not convert rules because source is empty
16:09:22.010 [com.alibaba.nacos.client.Worker] ERROR c.a.n.c.r.client - [printIfErrorEnabled,99] - Send request fail, request=ConfigBatchListenRequest{headers={Client-AppName=unknown, Client-RequestTS=1623139761703, charset=UTF-8, Client-RequestToken=63fd2ac4c942e75574ad5ec033036167, exConfigInfo=true, Timestamp=1623139761703}, requestId='null'}, retryTimes=2,errorMessage=Client not connected,current status:STARTING
16:09:22.018 [com.alibaba.nacos.client.Worker] ERROR c.a.n.c.c.i.ClientWorker - [executeConfigListen,797] - Async listen config change error
com.alibaba.nacos.api.exception.NacosException: Client not connected,current status:STARTING
    at com.alibaba.nacos.common.remote.client.RpcClient.request(RpcClient.java:628)
    at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.requestProxy(ClientWorker.java:976)
    at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.requestProxy(ClientWorker.java:951)
    at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.executeConfigListen(ClientWorker.java:757)
    at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient$3.run(ClientWorker.java:677)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
16:09:22.277 [main] INFO  c.a.n.c.i.CredentialWatcher - [loadCredential,165] - null No credential found
16:09:22.380 [main] ERROR c.a.n.c.r.client - [printIfErrorEnabled,99] - Send request fail, request=SubscribeServiceRequest{headers={app=unknown}, requestId='null'}, retryTimes=0,errorMessage=Client not connected,current status:STARTING
16:09:22.481 [main] ERROR c.a.n.c.r.client - [printIfErrorEnabled,99] - Send request fail, request=SubscribeServiceRequest{headers={app=unknown}, requestId='null'}, retryTimes=1,errorMessage=Client not connected,current status:STARTING
16:09:22.582 [main] ERROR c.a.n.c.r.client - [printIfErrorEnabled,99] - Send request fail, request=SubscribeServiceRequest{headers={app=unknown}, requestId='null'}, retryTimes=2,errorMessage=Client not connected,current status:STARTING
16:09:22.582 [main] ERROR c.a.c.n.d.NacosWatch - [start,127] - namingService subscribe failed, properties:NacosDiscoveryProperties{serverAddr='localhost:8848', endpoint='', namespace='', watchDelay=30000, logName='', service='ruoyi-gateway', weight=1.0, clusterName='DEFAULT', group='DEFAULT_GROUP', namingLoadCacheAtStart='false', metadata={preserved.register.source=SPRING_CLOUD}, registerEnabled=true, ip='192.168.43.60', networkInterface='', port=-1, secure=false, accessKey='', secretKey='', heartBeatInterval=null, heartBeatTimeout=null, ipDeleteTimeout=null}
com.alibaba.nacos.api.exception.NacosException: Request nacos server failed:
    at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.requestToServer(NamingGrpcClientProxy.java:213)
    at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.subscribe(NamingGrpcClientProxy.java:172)
    at com.alibaba.nacos.client.naming.remote.NamingClientProxyDelegate.subscribe(NamingClientProxyDelegate.java:146)
    at com.alibaba.nacos.client.naming.NacosNamingService.subscribe(NacosNamingService.java:387)
    at com.alibaba.cloud.nacos.discovery.NacosWatch.start(NacosWatch.java:123)
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54)
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)
    at java.lang.Iterable.forEach(Iterable.java:75)
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155)
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
    at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:64)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:337)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1336)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1325)
    at com.ruoyi.gateway.RuoYiGatewayApplication.main(RuoYiGatewayApplication.java:17)

 

gateway配置如下

# Tomcat
server:
  port: 8099

# Spring
spring: 
  application:
    # 应用名称
    name: ruoyi-gateway
  profiles:
    # 环境配置
    active: dev
  main:
    allow-bean-definition-overriding: true
  cloud:
    nacos:
      discovery:
        # 服务注册地址
        server-addr: localhost:8848
      config:
        # 配置中心地址
        server-addr: localhost:8848
        # 配置文件格式
        file-extension: yml
        # 共享配置
        shared-configs:
          -application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
    sentinel:
      # 取消控制台懒加载
      eager: true
      transport:
        # 控制台地址
        dashboard: 127.0.0.1:8718
      # nacos配置持久化
      datasource:
        ds1:
          nacos:
            server-addr: 127.0.0.1:8848
            dataId: sentinel-ruoyi-gateway
            groupId: DEFAULT_GROUP
            data-type: json
            rule-type: flow

nacos中网关的配置如下:

spring:

redis:

host: localhost

port: 6379

password:

cloud:

gateway:

discovery:

locator:

lowerCaseServiceId: true

enabled: true

routes:

# 认证中心

- id: ruoyi-auth

uri: lb://ruoyi-auth

predicates:

- Path=/auth/**

filters:

# 验证码处理

- CacheRequestFilter

- ValidateCodeFilter

- StripPrefix=1

# 代码生成

- id: ruoyi-gen

uri: lb://ruoyi-gen

predicates:

- Path=/code/**

filters:

- StripPrefix=1

# 定时任务

- id: ruoyi-job

uri: lb://ruoyi-job

predicates:

- Path=/schedule/**

filters:

- StripPrefix=1

# 系统模块

- id: ruoyi-system

uri: lb://ruoyi-system

predicates:

- Path=/system/**

filters:

- StripPrefix=1

# 文件服务

- id: ruoyi-file

uri: lb://ruoyi-file

predicates:

- Path=/file/**

filters:

- StripPrefix=1

 

# 不校验白名单

ignore:

whites:

- /auth/logout

- /auth/login

- /*/v2/api-docs

- /csrf

 

  • 写回答

8条回答 默认 最新

  • 野人及伴i 2021-07-13 14:17
    关注

    本地的nacos启动了,可以正常访问控制台,但是程序访问报错:namingService subscribe failed,有没有大佬呀

    评论

报告相同问题?

悬赏问题

  • ¥30 STM32 INMP441无法读取数据
  • ¥100 求汇川机器人IRCB300控制器和示教器同版本升级固件文件升级包
  • ¥15 用visualstudio2022创建vue项目后无法启动
  • ¥15 x趋于0时tanx-sinx极限可以拆开算吗
  • ¥500 把面具戴到人脸上,请大家贡献智慧
  • ¥15 任意一个散点图自己下载其js脚本文件并做成独立的案例页面,不要作在线的,要离线状态。
  • ¥15 各位 帮我看看如何写代码,打出来的图形要和如下图呈现的一样,急
  • ¥30 c#打开word开启修订并实时显示批注
  • ¥15 如何解决ldsc的这条报错/index error
  • ¥15 VS2022+WDK驱动开发环境