2

こんにちは、2 つのマイクロサービス 1. spotparkin と 2. spotparking2 を作成しました。これらは eureka サーバーに正常に登録されました。その後、リボン クライアントを作成し、アプリケーション名 spotpaking を使用してレスト コールを試みました。これは、application.yml で指定したアプリケーション名です。両方のマイクロサービスのファイルですが、以下のエラーが発生しています:

2016-10-16 13:28:35.177 ERROR 11304 --- [nio-7213-exec-1] oaccC[.[.[/].[dispatcherServlet] : コンテキスト内のサーブレット [dispatcherServlet] の Servlet.service() with path [] が例外をスローしました [リクエストの処理に失敗しました。ネストされた例外は org.springframework.web.client.ResourceAccessException: I/O error on GE T request for " http://spotparking/spotparking/pincode ": spotparking; です。ネストされた例外は、根本原因を持つ java.net.UnknownHostException: spotparking] です

java.net.UnknownHostException: java.net.AbstractPlainSocketImpl.connect でのスポットパーキング (不明なソース) ~[na:1.8.0_101]

ParkingSpot parkingSpot = restTemplate.exchange("http://spotparking/spotparking/{pincode}",HttpMethod.GET,null,new ParameterizedTypeReference<ParkingSpot>() {}, pincode).getBody();
        return new MessageWrapper<>(parkingSpot, "server called using eureka with rest template");

This is how it is comming up in eureka:  

ここに画像の説明を入力

ソース コードはhttps://github.com/focode/microservices2/で入手できます。

4

1 に答える 1

2

@LoadBalanced がリボンになく、追加されました

client:
    serviceUrl:
      defaultZone: http://127.0.0.1:8761/eureka/
    lease:
      duration: 5

コードは現在機能しており、私の github アカウントから取得できます

于 2016-10-16T09:09:23.360 に答える