Tencent / spring-cloud-tencent

Spring Cloud Tencent is a Spring Cloud based Service Governance Framework provided by Tencent.
Other
3.19k stars 492 forks source link

springboot admin 读取服务失败 #318

Closed u2young closed 2 years ago

u2young commented 2 years ago

Describe the bug SpringBootAdmin集成北极星时,不能正常加载服务列表,关键日志如下

d.c.b.a.s.c.d.InstanceDiscoveryListener t=polaris-polaris-service-refresh-1 | Unexpected error. java.lang.IllegalArgumentException: 'value' must not be empty
    at org.springframework.util.Assert.hasText(Assert.java:289)
    at de.codecentric.boot.admin.server.domain.values.BuildVersion.<init>(BuildVersion.java:33)
    at de.codecentric.boot.admin.server.domain.values.BuildVersion.valueOf(BuildVersion.java:38)
    at de.codecentric.boot.admin.server.domain.values.BuildVersion.from(BuildVersion.java:62)
    at de.codecentric.boot.admin.server.domain.entities.Instance$$Lambda$1234/0x0000000000000000.apply(Unknown Source)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
    at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
    at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
    at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:515)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:501)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:487)
    at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:239)
    at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
    at de.codecentric.boot.admin.server.domain.entities.Instance.updateBuildVersion(Instance.java:265)
    at de.codecentric.boot.admin.server.domain.entities.Instance.apply(Instance.java:208)
    at de.codecentric.boot.admin.server.domain.entities.Instance.register(Instance.java:120)
    at de.codecentric.boot.admin.server.services.InstanceRegistry.lambda$register$0(InstanceRegistry.java:57)
    at de.codecentric.boot.admin.server.services.InstanceRegistry$$Lambda$1227/0x0000000000000000.apply(Unknown Source)
    at de.codecentric.boot.admin.server.domain.entities.EventsourcingInstanceRepository.lambda$compute$6(EventsourcingInstanceRepository.java:76)
    at de.codecentric.boot.admin.server.domain.entities.EventsourcingInstanceRepository$$Lambda$1230/0x0000000000000000.get(Unknown Source)
    at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:44)
    at reactor.core.publisher.Mono.subscribe(Mono.java:4400)
    at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onComplete(FluxSwitchIfEmpty.java:82)
    at reactor.core.publisher.MonoFlatMap$FlatMapMain.onComplete(MonoFlatMap.java:181)
    at reactor.core.publisher.Operators.complete(Operators.java:137)
    at reactor.core.publisher.MonoEmpty.subscribe(MonoEmpty.java:46)
    at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
    at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
    at reactor.core.publisher.FluxRetryWhen.subscribe(FluxRetryWhen.java:77)
    at reactor.core.publisher.MonoRetryWhen.subscribeOrReturn(MonoRetryWhen.java:46)
    at reactor.core.publisher.Mono.subscribe(Mono.java:4385)
    at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:426)
    at reactor.core.publisher.FluxFilterFuseable$FilterFuseableSubscriber.onNext(FluxFilterFuseable.java:118)
    at reactor.core.publisher.FluxFlattenIterable$FlattenIterableSubscriber.drainSync(FluxFlattenIterable.java:604)
    at reactor.core.publisher.FluxFlattenIterable$FlattenIterableSubscriber.drain(FluxFlattenIterable.java:683)
    at reactor.core.publisher.FluxFlattenIterable$FlattenIterableSubscriber.request(FluxFlattenIterable.java:274)
    at reactor.core.publisher.FluxFilterFuseable$FilterFuseableSubscriber.request(FluxFilterFuseable.java:191)
    at reactor.core.publisher.FluxFlatMap$FlatMapMain.onSubscribe(FluxFlatMap.java:371)
    at reactor.core.publisher.FluxFilterFuseable$FilterFuseableSubscriber.onSubscribe(FluxFilterFuseable.java:87)
    at reactor.core.publisher.FluxFlattenIterable$FlattenIterableSubscriber.onSubscribe(FluxFlattenIterable.java:216)
    at reactor.core.publisher.FluxFilterFuseable$FilterFuseableSubscriber.onSubscribe(FluxFilterFuseable.java:87)
    at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:161)
    at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:87)
    at reactor.core.publisher.Mono.subscribe(Mono.java:4400)
    at reactor.core.publisher.Mono.subscribeWith(Mono.java:4515)
    at reactor.core.publisher.Mono.subscribe(Mono.java:4371)
    at reactor.core.publisher.Mono.subscribe(Mono.java:4307)
    at reactor.core.publisher.Mono.subscribe(Mono.java:4279)
    at de.codecentric.boot.admin.server.cloud.discovery.InstanceDiscoveryListener.discover(InstanceDiscoveryListener.java:129)
    at de.codecentric.boot.admin.server.cloud.discovery.InstanceDiscoveryListener.discoverIfNeeded(InstanceDiscoveryListener.java:120)
    at de.codecentric.boot.admin.server.cloud.discovery.InstanceDiscoveryListener.onApplicationEvent(InstanceDiscoveryListener.java:115)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:344)
    at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:229)
    at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:166)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378)
    at com.tencent.cloud.polaris.discovery.refresh.PolarisRefreshApplicationReadyEventListener.lambda$refresh$0(PolarisRefreshApplicationReadyEventListener.java:74)
    at com.tencent.cloud.polaris.discovery.refresh.PolarisRefreshApplicationReadyEventListener$$Lambda$1376/0x00000000672b1b20.run(Unknown Source)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)

参考例子 https://github.com/Paul101432/sba-discovery/tree/polaris

Expected behavior 应能准确加载并无报错

chuntaojun commented 2 years ago

ok。we will fix it

SkyeBeFreeman commented 2 years ago

感谢反馈!我看下对spring-boot-admin的支持。

SkyeBeFreeman commented 2 years ago

@Paul101432 这个问题是北极星服务端在查询实例时在metadata返回了空字符串的version信息导致的,修复代码已经提交给北极星,fix:fix return of empty string. #484

企业微信截图_36c070dc-fb61-448a-a3bb-c5b4d0ac2988