0
我正在嘗試使用docker來運行我的jgster微服務。Jhipster,無法連接集裝箱的mongodb
我在沒有Docker的情況下運行時沒有問題。但是現在,當我嘗試使用docker運行我的微服務時,我正面臨着一些問題。
每次我執行
泊塢窗,構成-f我UAA服務器上app.yml了
命令,它運行UAA服務器時顯示此錯誤。
uaa-app_1 | 2017-04-17 07:38:59.725 DEBUG 6 --- [ main] i.c.f.uaa.config.CacheConfiguration : No cache
uaa-app_1 | 2017-04-17 07:39:06.897 DEBUG 6 --- [ main] i.c.f.u.c.apidoc.SwaggerConfiguration : Starting Swagger
uaa-app_1 | 2017-04-17 07:39:06.914 DEBUG 6 --- [ main] i.c.f.u.c.apidoc.SwaggerConfiguration : Started Swagger in 16 ms
uaa-app_1 | 2017-04-17 07:39:07.004 DEBUG 6 --- [ main] i.c.f.uaa.config.DatabaseConfiguration : Configuring Mongobee
uaa-app_1 | 2017-04-17 07:39:07.020 INFO 6 --- [ main] com.github.mongobee.Mongobee : Mongobee has started the data migration sequence..
uaa-app_1 | 2017-04-17 07:39:37.056 WARN 6 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongobee' defined in class path resource [id/co/fifgroup/uaa/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]
uaa-app_1 | 2017-04-17 07:39:37.074 INFO 6 --- [ main] i.c.f.uaa.config.CacheConfiguration : Closing Cache Manager
uaa-app_1 | 2017-04-17 07:39:37.129 ERROR 6 --- [ main] o.s.boot.SpringApplication : Application startup failed
uaa-app_1 |
uaa-app_1 | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongobee' defined in class path resource [id/co/fifgroup/uaa/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]
這是我在碼頭目錄中的UAA服務器app.yml。
version: '2'
services:
uaa-app:
image: uaa
external_links:
- uaa-mongodb:mongodb
- jhipster-registry:registry
environment:
- SPRING_PROFILES_ACTIVE=dev,swagger
- SPRING_CLOUD_CONFIG_URI=http://admin:[email protected]:8761/config
- SPRING_DATA_MONGODB_URI=mongodb://mongodb:27017
- SPRING_DATA_MONGODB_DATABASE=uaa
- JHIPSTER_SLEEP=15 # gives time for the database to boot before the application
uaa-mongodb:
extends:
file: mongodb.yml
service: uaa-mongodb
jhipster-registry:
extends:
file: jhipster-registry.yml
service: jhipster-registry
environment:
- SPRING_CLOUD_CONFIG_SERVER_NATIVE_SEARCH_LOCATIONS=file:./central-config/docker-config/
UAA-的MongoDB和jhipster的註冊表正常工作與碼頭工人,但我的UAA服務器無法連接到UAA-MongoDB的。
,爲什麼錯誤一直說我使用本地主機:27017甚至thoug我試圖改變SPRING_DATA_MONGODB_URI和spring.data.mongodb.uri內應用dev.yml和應用prod.yml到差值。
有人可以幫我解決這個問題...