当前位置: 首页 > 知识库问答 >
问题:

健康检查时Spring Boot Admin非法字符

南门鸿振
2023-03-14

我使用Spring cloud Netflix OSS部署了几个Spring boot应用程序,并配置了Spring boot Admin来监控那些连接到Eureka服务器的应用程序。但对于其中两个应用程序,我得到了以下错误。你能告诉我这个错误的原因是什么,以及如何缓解这个问题吗。

这个endpoint健康URL由Spring boot actuator提供,健康URL的输出是{“description”:“Spring Cloud Eureka Discovery Client”,“status”:“UP”}

日志中的错误

2017-10-02 18:29:31.790 ERROR 5976 --- [DiscoveryClient-CacheRefreshExecutor-0] d.c.b.a.d.ApplicationDiscoveryListener   : Couldn't register application for service org.springframework.cloud.netflix.eureka.EurekaDiscoveryClient$EurekaServiceInstance@3e988b86

java.lang.IllegalArgumentException: Illegal character in path at index 61: http://xxxx:56412/manage/health 
    at java.net.URI.create(URI.java:852) ~[na:1.8.0_131]
    at de.codecentric.boot.admin.discovery.EurekaServiceInstanceConverter.getHealthUrl(EurekaServiceInstanceConverter.java:46) ~[spring-boot-admin-server-1.5.0.jar!/:1.5.0]
    at de.codecentric.boot.admin.discovery.DefaultServiceInstanceConverter.convert(DefaultServiceInstanceConverter.java:64) ~[spring-boot-admin-server-1.5.0.jar!/:1.5.0]
    at de.codecentric.boot.admin.discovery.ApplicationDiscoveryListener.register(ApplicationDiscoveryListener.java:138) [spring-boot-admin-server-1.5.0.jar!/:1.5.0]
    at de.codecentric.boot.admin.discovery.ApplicationDiscoveryListener.discover(ApplicationDiscoveryListener.java:94) [spring-boot-admin-server-1.5.0.jar!/:1.5.0]
    at de.codecentric.boot.admin.discovery.ApplicationDiscoveryListener.discoverIfNeeded(ApplicationDiscoveryListener.java:85) [spring-boot-admin-server-1.5.0.jar!/:1.5.0]
    at de.codecentric.boot.admin.discovery.ApplicationDiscoveryListener.onApplicationEvent(ApplicationDiscoveryListener.java:80) [spring-boot-admin-server-1.5.0.jar!/:1.5.0]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
    at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:253) [spring-context-4.3.9.RELEASE.jar!/:4.3.9.RELEASE]
    at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:174) [spring-context-4.3.9.RELEASE.jar!/:4.3.9.RELEASE]
    at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:137) [spring-context-4.3.9.RELEASE.jar!/:4.3.9.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167) [spring-context-4.3.9.RELEASE.jar!/:4.3.9.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) [spring-context-4.3.9.RELEASE.jar!/:4.3.9.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393) [spring-context-4.3.9.RELEASE.jar!/:4.3.9.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347) [spring-context-4.3.9.RELEASE.jar!/:4.3.9.RELEASE]
    at org.springframework.cloud.netflix.eureka.CloudEurekaClient.onCacheRefreshed(CloudEurekaClient.java:98) [spring-cloud-netflix-eureka-client-1.3.1.RELEASE.jar!/:1.3.1.RELEASE]
    at com.netflix.discovery.DiscoveryClient.fetchRegistry(DiscoveryClient.java:943) [eureka-client-1.6.2.jar!/:1.6.2]
    at com.netflix.discovery.DiscoveryClient.refreshRegistry(DiscoveryClient.java:1451) [eureka-client-1.6.2.jar!/:1.6.2]
    at com.netflix.discovery.DiscoveryClient$CacheRefreshThread.run(DiscoveryClient.java:1418) [eureka-client-1.6.2.jar!/:1.6.2]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_131]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_131]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_131]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_131]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]
Caused by: java.net.URISyntaxException: Illegal character in path at index 61: http://xxxxx:56412/manage/health 
    at java.net.URI$Parser.fail(URI.java:2848) ~[na:1.8.0_131]
    at java.net.URI$Parser.checkChars(URI.java:3021) ~[na:1.8.0_131]
    at java.net.URI$Parser.parseHierarchical(URI.java:3105) ~[na:1.8.0_131]
    at java.net.URI$Parser.parse(URI.java:3053) ~[na:1.8.0_131]
    at java.net.URI.<init>(URI.java:588) ~[na:1.8.0_131]
    at java.net.URI.create(URI.java:850) ~[na:1.8.0_131]
    ... 26 common frames omitted

共有1个答案

姬旭
2023-03-14

在URL的末尾有一个额外的空格

eureka.instance.healthCheckUrlPath=${management.context-path}/health 

应该是的

eureka.instance.healthCheckUrlPath=${management.context-path}/health
 类似资料:
  • SOFABoot 为 Spring Boot 的健康检查能力增加了 Readiness Check 的能力。如果你需要使用 SOFA 中间件,那么建议使用 SOFABoot 的健康检查能力的扩展,来更优雅的上线应用实例 引入健康检查扩展 要引入 SOFABoot 的健康检查能力的扩展,只需要引入以下的 Starter 即可: <dependency> <groupId>com.alipay

  • 健康检查配置概述。 filter.http.HealthCheck filter.http.HealthCheck proto { "pass_through_mode": "{...}", "endpoint": "...", "cache_time": "{...}" } pass_through_mode (BoolValue, REQUIRED) 指定过滤器是否在传递模式下运

  • 健康检查架构概述。如果为集群配置了健康检查,则会发出相应的统计信息。详见请参考统计相关文档。 HealthCheck HealthCheck.Payload HealthCheck.HttpHealthCheck HealthCheck.TcpHealthCheck HealthCheck.RedisHealthCheck HealthCheck HealthCheck proto { "ti

  • 健康检查架构概述。 如果为集群配置了健康检查,则会发出相应的统计信息。并且记录在这里。 { "type": "...", "timeout_ms": "...", "interval_ms": "...", "unhealthy_threshold": "...", "healthy_threshold": "...", "path": "...", "send": [

  • 健康检查配置概述。 { "name": "health_check", "config": { "pass_through_mode": "...", "endpoint": "...", "cache_time_ms": "..." } } pass_through_mode (required, boolean) 指定过滤器是否在通过模式下运行。 end

  • 健康检查架构概述 如果为集群配置了健康检查,则会触发其他统计信息。详见这里文档。 v1 API文档 v2 API文档 TCP健康检查 注意:本文是为v1 API编写的,但这些概念也适用于v2 API。它将在未来版本中使用v2 API重写。 执行的匹配类型如下(这是MongoDB运行健康检查请求和响应): { "send": [ {"binary": "39000000"},