带有 Eureka 客户端的 StackSaga 失败并出现错误 - 服务到服务通信失败

问题描述 投票:0回答:1

属性文件。

spring.application.name=user-service
server.port=0

management.server.port=2077
management.endpoints.web.exposure.include=*

stacksaga.enable=true
stacksaga.transaction-id-prefix=us
stacksaga.app-release-version=1.0.0
stacksaga.component-scan=com.example


stacksaga.connect.admin-url=http://localhost:4444
stacksaga.connect.admin-username=user-service
stacksaga.connect.admin-password=mglMhRAHr1cEea83

2023-09-26 23:12:46.591 DEBUG [user-service,,] 21992 --- [           main] .InternalServiceCommunicationCoordinator : Internal service-communication validation URL : http://192.168.8.101:9354/actuator/stacksaga/validate
2023-09-26 23:12:47.599 DEBUG [user-service,,] 21992 --- [           main] .InternalServiceCommunicationCoordinator : Internal service-communication validation URL : http://192.168.8.101:9354/actuator/stacksaga/validate
2023-09-26 23:12:48.604 DEBUG [user-service,,] 21992 --- [           main] .InternalServiceCommunicationCoordinator : Internal service-communication validation URL : http://192.168.8.101:9354/actuator/stacksaga/validate
2023-09-26 23:12:49.610 DEBUG [user-service,,] 21992 --- [           main] .InternalServiceCommunicationCoordinator : Internal service-communication validation URL : http://192.168.8.101:9354/actuator/stacksaga/validate
2023-09-26 23:12:50.620 DEBUG [user-service,,] 21992 --- [           main] .InternalServiceCommunicationCoordinator : Internal service-communication validation URL : http://192.168.8.101:9354/actuator/stacksaga/validate
2023-09-26 23:12:51.628 DEBUG [user-service,,] 21992 --- [           main] .InternalServiceCommunicationCoordinator : Internal service-communication validation URL : http://192.168.8.101:9354/actuator/stacksaga/validate
2023-09-26 23:12:52.634 DEBUG [user-service,,] 21992 --- [           main] .InternalServiceCommunicationCoordinator : Internal service-communication validation URL : http://192.168.8.101:9354/actuator/stacksaga/validate
2023-09-26 23:12:53.640 DEBUG [user-service,,] 21992 --- [           main] .InternalServiceCommunicationCoordinator : Internal service-communication validation URL : http://192.168.8.101:9354/actuator/stacksaga/validate
2023-09-26 23:12:54.645 DEBUG [user-service,,] 21992 --- [           main] .InternalServiceCommunicationCoordinator : Internal service-communication validation URL : http://192.168.8.101:9354/actuator/stacksaga/validate
2023-09-26 23:12:54.652 ERROR [user-service,,] 21992 --- [           main] o.s.cloud.config.ApplicationStartConfig  : Validation of service-to-service communication is failed.
2023-09-26 23:12:54.653  WARN [user-service,,] 21992 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is 
[StackSaga Error Code: SS-0034]
[See More: https://www.stacksaga.org/1.0.0/errors?errorCode=SS-0034]
[Message: Validation of service-to-service (internal) communication is failed. [URL : http://192.168.8.101:9354/actuator/stacksaga/validate]]
org.stacksaga.exception.InternalCommunicationFailedException: Validation of service-to-service (internal) communication is failed. [URL : http://192.168.8.101:9354/actuator/stacksaga/validate]
2023-09-26 23:12:54.669  INFO [user-service,,] 21992 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
spring-boot spring-cloud netflix-eureka stacksaga
1个回答
0
投票

问题在于

server.port
management.server.port
不同。如果管理服务器在不同的端口上运行,您必须向 StackSaga 提及该端口。如果不这样做,StackSaga 将使用已启动的默认 Web 服务器端口。

由于您使用的是 StackSaga 客户端和 Eureka 客户端,您可以像下面这样进行配置。

#The port should be the same as that used for the management server.
eureka.instance.metadata-map.stacksagaManagementPort=2077
© www.soinside.com 2019 - 2024. All rights reserved.