spring-boot-actuator配置后,监控端点无效

在集成Actuator依赖后,访问/health端点出现故障。排除版本不匹配原因后,从日志中发现需添加特定路径。添加后服务成功启动,暴露了/actuator下的两个端点。但在后续请求中遇到连接拒绝错误,可能是目标服务未运行或网络问题导致。
摘要由CSDN通过智能技术生成

如图:按书中包含了actuator的依赖后,访问health节点失败。

一开始以为是版本不对,比对确认版本没问题。

 

分析服务启动时的log发现,下面标红的内容,加上这个path果然可以了。

2021-01-28 16:33:00.194  INFO 6540 --- [           main] croserviceSimpleConsumerMovieApplication : No active profile set, falling back to default profiles: default
2021-01-28 16:33:00.644  INFO 6540 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=df879624-8f35-3288-b32e-6d9ff4686b23
2021-01-28 16:33:00.785  INFO 6540 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8001 (http)
2021-01-28 16:33:00.794  INFO 6540 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-01-28 16:33:00.794  INFO 6540 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.41]
2021-01-28 16:33:00.892  INFO 6540 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-01-28 16:33:00.892  INFO 6540 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 682 ms
2021-01-28 16:33:01.100  INFO 6540 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2021-01-28 16:33:01.794  INFO 6540 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2021-01-28 16:33:01.865  INFO 6540 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8001 (http) with context path ''
2021-01-28 16:33:02.245  INFO 6540 --- [           main] croserviceSimpleConsumerMovieApplication : Started MicroserviceSimpleConsumerMovieApplication in 3.566 seconds (JVM running for 4.531)
2021-01-28 16:33:02.796  INFO 6540 --- [)-192.168.43.45] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-01-28 16:33:02.796  INFO 6540 --- [)-192.168.43.45] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2021-01-28 16:33:02.804  INFO 6540 --- [)-192.168.43.45] o.s.web.servlet.DispatcherServlet        : Completed initialization in 8 ms
2021-01-28 16:33:21.770 ERROR 6540 --- [nio-8001-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8000/1": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect] with root cause
 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值