2017-02-22 44 views
1

我正在嘗試使用這個tutorial來構建示例microservice應用程序。 Jhipster版本是4.0.6 所以我建立的網關服務,使用此命令啓動領事:與領事開始jHipster微服務的錯誤

docker-compose -f src/main/docker/consul.yml up 

從我的網關目錄。 但在春季引導啓動出現錯誤,這裏是日誌:

2017-02-22 11:52:25.679 ERROR 3168 --- [ restartedMain] o.s.c.c.c.ConsulPropertySourceLocator : Fail fast is set and there was an error reading configuration from consul. 

2017-02-22 11:52:32.491 WARN 3168 --- [ restartedMain] o.s.boot.SpringApplication    : Error handling failed (ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot[email protected]2a5b2096: startup date [Thu Jan 01 03:00:00 AST 1970]; parent: org.spring[email protected]5108df79) 
com.ecwid.consul.transport.TransportException: java.net.ConnectException: Connection refused: connect 

能否請您協助這個問題?

更新: 我發現應用程序試圖使GET請求對staptup網址:

http://localhost:8500/v1/kv/config/armory,dev/?recurse&token= 

而是存儲在領事K /五,儲存的唯一數據是:

KEY: config/application/data 

VALUE: 
configserver: 
    name: Docker Consul Service 
    status: Connected to Consul Server running in Docker 

jhipster: 
    security: 
     authentication: 
      jwt: 
       secret: my-secret-token-to-change-in-production 

回答

3

如果consul正在dev配置文件中運行,或者如果consul正在prod配置文件中運行,則必須將您的應用程序yaml配置複製到您的consul實例as explained in the doccentral-server-config目錄中。

因此,假設您的應用程序被命名爲「兵工廠」你應該複製你的src/main/resources/config/application.ymlarmory.yml併爲每個配置文件(例如application-dev.ymlarmory-dev.yml

+0

非常感謝!你能不能請協助從'localhost'覆蓋默認的領事港口到碼頭的港口?我應該在哪裏改變它? – Tolledo

+0

我不知道,你看過你的應用程序的bootstrap.yml嗎? –

+0

我面臨同樣的問題,@Tolledo是否找到解決方案? – Martin