Sentinel 1.8.0集成Spring Cloud Alibaba 2.2.1.RELEASE的引发的bug处理

当尝试集成Sentinel 1.8.0与Spring Cloud Alibaba 2.2.1.RELEASE时,出现启动异常和健康检查500错误。错误源于SentinelTransportConfig方法更改。解决方案包括关注官方修复的issue或临时复写SentinelHealthIndicator类。提供了代码样例和微服务框架MateCloud的参考链接。
摘要由CSDN通过智能技术生成

问题描述

启动后报:
程序异常:org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: com.alibaba.csp.sentinel.transport.config.TransportConfig.getConsoleServer()Ljava/lang/String;
健康检查报500错误

问题分析

  1. 查看’SentinelHealthIndicator’代码第47行
  2. 查看sentinel1.8.0版本的TransportConfig的66行
  3. Method由getConsoleServe()->getConsoleServerList()
  4. 以上问题导致报上述BUG

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

解决方案

终极方案

已提issue,等待官方版本修复
https://github.com/alibaba/spring-cloud-alibaba/issues/1680

临时方案

复写SentinelHealthIndicator类,代码如下:

package com.alibaba.cloud.sentinel.endpoint;

import com.alibaba.cloud.sentinel.SentinelProperties;
import com.alibaba.csp.sentinel.datasource.AbstractDataSource;
import com.alibaba.csp.sentinel.heartbeat.HeartbeatSenderProvider;
import com.alibaba.csp.sentinel.transport.HeartbeatSender;
import com.alibaba.csp.sentinel.transport.config.TransportConfig;
import com.alibaba.csp.sentinel.util.function.Tuple2;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
import org.springframework.boot.actuate.health.Health;
import org
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值