Search code examples
spring-bootmicroservicesspring-cloudstacksaga

The eureka Instance-Id is not valid for Stacksaga


org.stacksaga.exception.InstanceIdNotValidException: The eureka Instance-Id is not valid for Stacksaga. [instanceId : user-service:a07a498249971cfa6de45fe1cdbeb670]
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181)
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54)
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)
    at java.base/java.lang.Iterable.forEach(Iterable.java:75)
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155)
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292)
    at com.example.userservice.UserServiceApplication.main(UserServiceApplication.java:12)

Solution

  • You might have configured Eureka instance-id like below.

    eureka.instance.instance-id=${spring.application.name}:${random.value}
    

    If you are using StackSaga, using the colon symbol : is not recommended. you can replace it with the hyphen symbol - or the underscore symbol _ like below.

    eureka.instance.instance-id=${spring.application.name}-${random.value}