Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException

项目中新增了一个服务,在Gateway网关中配置路由后,报如下错误

This application has no configured error view, so you are seeing this as a fallback.

Sun Aug 21 23:08:53 CST 2022
[9d9770fe-1] There was an unexpected error (type=Not Found, status=404).
org.springframework.web.server.ResponseStatusException: 404 NOT_FOUND
at org.springframework.web.reactive.resource.ResourceWebHandler.lambda$handle 0 ( R e s o u r c e W e b H a n d l e r . j a v a : 325 ) S u p p r e s s e d : r e a c t o r . c o r e . p u b l i s h e r . F l u x O n A s s e m b l y 0(ResourceWebHandler.java:325) Suppressed: reactor.core.publisher.FluxOnAssembly 0(ResourceWebHandler.java:325)Suppressed:reactor.core.publisher.FluxOnAssemblyOnAssemblyException:
Error has been observed at the following site(s):
|_ checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ HTTP GET “/course-orientation/page” [ExceptionHandlingWebHandler]

可以看到报了一大堆的错误,

我们看最主要的错误:404 NOT_FOUND,经典的404

出现这个错误就是因为你要访问的资源不存在,因为资源的访问是在网关中统一配置的

所以要去看网关服务中的配置文件,写的有没有什么问题

如果你的配置文件是yml/yaml格式的,那要注意看看缩进是不是有问题

比如

spring:
  application:      #服务名
    name: edu-gateway-service
  cloud:
    gateway:
      routes:       #路由
        - id: edu-ad-service
          uri: lb://edu-ad-service
          predicates:
            - Path=/promotion-ad/**,/promotion-space/**
        - id: edu-course-service
          uri: lb://edu-course-service
          predicates:
            - Path=/course-type/**,/course-orientation/**

因为yml/yaml是以缩进和空格来进行区分的,如果多打或少打一个空格,整个就会出现问题,

所以在编写yml/yaml格式的配置文件时要特别注意!

好,如果你的配置文件写的都没有问题的话,但是项目跑起来还是报这个错

那就要去看你有没有在配置中心Config进行同步修改,如果你只改了本地的配置文件,但是配置中心没有修改,那你在本地的修改是没有用的,因为如果你在配置中心进行配置了,那它默认就会去配置中心找,本地的配置不会生效。

当配置中心和本地配置同步了,再次启动项目,项目就能正常跑起来了,OK,问题完美解决!

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值