0

I'm trying to do a microservice architecture with dockerized springboot applications.

For inner communications I want to use Eureka + FeignClient. The registration with Eureka works fine (afaik):

    <application>
    <name>CAREER-SERVICE</name>
    <instance>
        <instanceId>4b62546fdc9b:career-service:7000</instanceId>
        <hostName>172.18.0.15</hostName>
        <app>CAREER-SERVICE</app>
        <ipAddr>172.18.0.15</ipAddr>
        <status>UP</status>
        <overriddenstatus>UNKNOWN</overriddenstatus>
        <port enabled="true">7000</port>
        <securePort enabled="false">443</securePort>
        <countryId>1</countryId>
        <dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
            <name>MyOwn</name>
        </dataCenterInfo>
        <leaseInfo>
            <renewalIntervalInSecs>30</renewalIntervalInSecs>
            <durationInSecs>90</durationInSecs>
            <registrationTimestamp>1497345551521</registrationTimestamp>
            <lastRenewalTimestamp>1497347501260</lastRenewalTimestamp>
            <evictionTimestamp>0</evictionTimestamp>
            <serviceUpTimestamp>1497345550971</serviceUpTimestamp>
        </leaseInfo>
        <metadata class="java.util.Collections$EmptyMap"/>
        <homePageUrl>http://172.18.0.15:7000/</homePageUrl>
        <statusPageUrl>http://172.18.0.15:7000/info</statusPageUrl>
        <healthCheckUrl>http://172.18.0.15:7000/health</healthCheckUrl>
        <vipAddress>career-service</vipAddress>
        <secureVipAddress>career-service</secureVipAddress>
        <isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
        <lastUpdatedTimestamp>1497345551521</lastUpdatedTimestamp>
        <lastDirtyTimestamp>1497345550555</lastDirtyTimestamp>
        <actionType>ADDED</actionType>
    </instance>
</application>
<application>
    <name>AUTH-SERVICE</name>
    <instance>
        <instanceId>5ecc30b0fcd1:auth-service:5000</instanceId>
        <hostName>172.18.0.11</hostName>
        <app>AUTH-SERVICE</app>
        <ipAddr>172.18.0.11</ipAddr>
        <status>UP</status>
        <overriddenstatus>UNKNOWN</overriddenstatus>
        <port enabled="true">5000</port>
        <securePort enabled="false">443</securePort>
        <countryId>1</countryId>
        <dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
            <name>MyOwn</name>
        </dataCenterInfo>
        <leaseInfo>
            <renewalIntervalInSecs>30</renewalIntervalInSecs>
            <durationInSecs>90</durationInSecs>
            <registrationTimestamp>1497345537851</registrationTimestamp>
            <lastRenewalTimestamp>1497347517943</lastRenewalTimestamp>
            <evictionTimestamp>0</evictionTimestamp>
            <serviceUpTimestamp>1497345536974</serviceUpTimestamp>
        </leaseInfo>
        <metadata class="java.util.Collections$EmptyMap"/>
        <homePageUrl>http://172.18.0.11:5000/</homePageUrl>
        <statusPageUrl>http://172.18.0.11:5000/info</statusPageUrl>
        <healthCheckUrl>http://172.18.0.11:5000/health</healthCheckUrl>
        <vipAddress>auth-service</vipAddress>
        <secureVipAddress>auth-service</secureVipAddress>
        <isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
        <lastUpdatedTimestamp>1497345537851</lastUpdatedTimestamp>
        <lastDirtyTimestamp>1497345506847</lastDirtyTimestamp>
        <actionType>ADDED</actionType>
    </instance>
</application>

In one of my services I need to access the auth-service and try to do it with the interface AuthServiceClient and @FeignClient Annotation:

FeignClient(name = "auth-service")
public interface AuthServiceClient {

  @RequestMapping(method = RequestMethod.POST, value = "/users", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
  void createUser(User user);
}

When I call that Method I get the following Exception:

account_1               | 2017-06-13 09:55:35.654 ERROR 1 --- [nio-6000-exec-6] o.a.c.c.C.[.[.[.[dispatcherServlet]      : Servlet.service() for servlet [dispatcherServlet] in context with path [/accounts] threw exception [Request processing failed; nested exception is com.netflix.hystrix.exception.HystrixRuntimeException: createUser failed and no fallback available.] with root cause
account_1               |
account_1               | java.net.UnknownHostException: auth-service

The registered IPs are correct I just wonder why he doesn't know 'auth-service'. So I guess he is probably not even trying to talk to Eureka? How can I debug in that way?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Rob987
  • 11
  • 3
  • Did you do `@EnableFeignClients`? What about restarting applications? – nurgasemetey Jun 13 '17 at 11:52
  • Do you have `@EnableDiscoveryClient` on your client app? And is `'org.springframework.cloud:spring-cloud-starter-eureka` in the classpath? – jihor Jun 20 '17 at 17:48

0 Answers0