nacos get changed dataId error, code: 403

application.properties 修改nacos权限验证之后

nacos.core.auth.caching.enabled=true

项目启动之后,一直刷新提示:[check-update] get changed dataId error, code: 403

[2021-12-30 15:01:22.247] loit-sample-getway [     ] [] [com.alibaba.nacos.client.Worker.longPolling.fixed-127.0.0.1_8848-c505697b-48e6-43b6-a3bd-38a354d71e69] ERROR com.alibaba.nacos.client.config.impl.ClientWorker - [fixed-127.0.0.1_8848-c505697b-48e6-43b6-a3bd-38a354d71e69] [check-update] get changed dataId error, code: 403
[2021-12-30 15:01:22.447] loit-sample-getway [     ] [] [com.alibaba.nacos.client.Worker.longPolling.fixed-127.0.0.1_8848-c505697b-48e6-43b6-a3bd-38a354d71e69] ERROR com.alibaba.nacos.client.config.impl.ClientWorker - [fixed-127.0.0.1_8848-c505697b-48e6-43b6-a3bd-38a354d71e69] [check-update] get changed dataId error, code: 403
[2021-12-30 15:01:22.647] loit-sample-getway [     ] [] [com.alibaba.nacos.client.Worker.longPolling.fixed-127.0.0.1_8848-c505697b-48e6-43b6-a3bd-38a354d71e69] ERROR com.alibaba.nacos.client.config.impl.ClientWorker - [fixed-127.0.0.1_8848-c505697b-48e6-43b6-a3bd-38a354d71e69] [check-update] get changed dataId error, code: 403
[2021-12-30 15:01:22.728] loit-sample-getway [     ] [] [com.alibaba.nacos.client.naming.updater] INFO  com.alibaba.nacos.client.naming - removed ips(1) service: DEFAULT_GROUP@@loit-sample-getway -> [{"instanceId":"192.168.189.1#7001#DEFAULT#DEFAULT_GROUP@@loit-sample-getway","ip":"192.168.189.1","port":7001,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@loit-sample-getway","metadata":{"preserved.register.source":"SPRING_CLOUD","version":"2.0.0"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000}]
[2021-12-30 15:01:22.729] loit-sample-getway [     ] [] [com.alibaba.nacos.client.naming.updater] INFO  com.alibaba.nacos.client.naming - current ips:(0) service: DEFAULT_GROUP@@loit-sample-getway -> []
[2021-12-30 15:01:22.847] loit-sample-getway [     ] [] [com.alibaba.nacos.client.Worker.longPolling.fixed-127.0.0.1_8848-c505697b-48e6-43b6-a3bd-38a354d71e69] ERROR com.alibaba.nacos.client.config.impl.ClientWorker - [fixed-127.0.0.1_8848-c505697b-48e6-43b6-a3bd-38a354d71e69] [check-update] get changed dataId error, code: 403
[2021-12-30 15:01:23.047] loit-sample-getway [     ] [] [com.alibaba.nacos.client.Worker.longPolling.fixed-127.0.0.1_8848-c505697b-48e6-43b6-a3bd-38a354d71e69] ERROR com.alibaba.nacos.client.config.impl.ClientWorker - [fixed-127.0.0.1_8848-c505697b-48e6-43b6-a3bd-38a354d71e69] [check-update] get changed dataId error, code: 403
[2021-12-30 15:01:23.246] loit-sample-getway [     ] [] [com.alibaba.nacos.client.Worker.longPolling.fixed-127.0.0.1_8848-c505697b-48e6-43b6-a3bd-38a354d71e69] ERROR com.alibaba.nacos.client.config.impl.ClientWorker - [fixed-127.0.0.1_8848-c505697b-48e6-43b6-a3bd-38a354d71e69] [check-update] get changed dataId error, code: 403
[2021-12-30 15:01:23.447] loit-sample-getway [     ] [] [com.alibaba.nacos.client.Worker.longPolling.fixed-127.0.0.1_8848-c505697b-48e6-43b6-a3bd-38a354d71e69] ERROR com.alibaba.nacos.client.config.impl.ClientWorker - [fixed-127.0.0.1_8848-c505697b-48e6-43b6-a3bd-38a354d71e69] [check-update] get changed dataId error, code: 403
[2021-12-30 15:01:23.648] loit-sample-getway [     ] [] [com.alibaba.nacos.client.Worker.longPolling.fixed-127.0.0.1_8848-c505697b-48e6-43b6-a3bd-38a354d71e69] ERROR com.alibaba.nacos.client.config.impl.ClientWorker - [fixed-127.0.0.1_8848-c505697b-48e6-43b6-a3bd-38a354d71e69] [check-update] get changed dataId error, code: 403
com.alibaba.nacos.api.exception.NacosException: 

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Thu Dec 30 15:09:19 CST 2021
There was an unexpected error (type=Forbidden, status=403).
unknown user!

解决办法:需要在运行项目的配置添加权限账号和密码

bootstrap.properties

spring.cloud.nacos.config.server-addr=127.0.0.1:8848
spring.cloud.nacos.config.namespace=c505697b-48e6-43b6-a3bd-38a354d71e69
spring.cloud.nacos.config.file-extension=yaml
spring.cloud.nacos.username=nacos
spring.cloud.nacos.password=nacos

application-dev.yml

  cloud:
    nacos:
      discovery:
        # Nacos 注册中心地址
        server-addr: 127.0.0.1:8848
        # 注册中心 命名空间
        namespace: c505697b-48e6-43b6-a3bd-38a354d71e69
        # 分组
        #group: DEFAULT_GROUP
        username: nacos
        password: nacos

    sentinel:
      # Sentinel 网关限流规则配置文件
      datasource.ds1.nacos:
        server-addr: ${spring.cloud.nacos.discovery.server-addr}
        namespace: ${spring.cloud.nacos.discovery.namespace}
        data-id: ${spring.application.name}-sentinel-gateway
        data-type: json
        group-id: DEFAULT_GROUP
        # 规则类型 限流配置
        ruleType: gw-flow
        username: nacos # 账号
        password: nacos # 密码

你可能感兴趣的:(【spring,cloud】,spring,cloud,eureka,云原生)