问题描述
启动后报:
程序异常: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错误
问题分析
- 查看’SentinelHealthIndicator’代码第47行
- 查看sentinel1.8.0版本的TransportConfig的66行
- Method由getConsoleServe()->getConsoleServerList()
- 以上问题导致报上述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