Docker dentro de PCF: no se puede conectar con rabbitmq a través de AMQP (bus en la nube de spring)

Estoy jugando con Pivotal cloudfoundry y docker. Por el momento, tengo una aplicación de arranque de spring que es un cliente de server de configuration junto con Cloudbus de spring. Esto funciona si presiono para PCF directamente usando cf push demo-application target/my-jar-file.jar .

Ahora estoy intentando empaquetar mi aplicación como un contenedor acoplable e insertlo en PCF con cf push demo2 -o rraghur/demo . PCF crea un contenedor y lo despliega, pero el cloudbus de spring no funciona. La configuration de resorte funciona, ya que veo lo siguiente en los loggings

 2016-11-30T22:23:58.771+05:30 [APP/0] [OUT] 2016-11-30 16:53:58.770 INFO 12 --- [ main] cccConfigServicePropertySourceLocator : Fetching config from server at: https://config-67936b3e-1626-46b6-8117-480654f34e49.local.pcfdev.io 2016-11-30T22:24:00.588+05:30 [APP/0] [OUT] 2016-11-30 16:54:00.587 INFO 12 --- [ main] cccConfigServicePropertySourceLocator : Located environment: name=demo-application, profiles=[production], label=null, version=45c09f139492055b3a023462c852b82ae0d396a4, state=null 

Sin embargo, parece que mi aplicación no puede conectarse con el enjambre rabbitmq inservible, excepciones como:

 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:547) ~[spring-rabbit-1.6.5.RELEASE.jar!/:na] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1389) ~[spring-rabbit-1.6.5.RELEASE.jar!/:na] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] 2016-11-30 16:54:01.015 WARN 12 --- [ main] osamqp.rabbit.core.RabbitAdmin : Failed to declare exchange: Exchange [name=springCloudBus, type=topic, durable=true, autoDelete=false, internal=false, arguments={}], continuing... 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused) 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:62) ~[spring-rabbit-1.6.5.RELEASE.jar!/:na] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:306) ~[spring-rabbit-1.6.5.RELEASE.jar!/:na] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1370) ~[spring-rabbit-1.6.5.RELEASE.jar!/:na] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1346) ~[spring-rabbit-1.6.5.RELEASE.jar!/:na] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.amqp.rabbit.core.RabbitAdmin.declareExchange(RabbitAdmin.java:157) ~[spring-rabbit-1.6.5.RELEASE.jar!/:na] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.cloud.stream.binder.rabbit.RabbitMessageChannelBinder.declareExchange(RabbitMessageChannelBinder.java:457) [spring-cloud-stream-binder-rabbit-1.1.1.RELEASE.jar!/:1.1.1.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.cloud.stream.binder.rabbit.RabbitMessageChannelBinder.createProducerDestinationIfNecessary(RabbitMessageChannelBinder.java:336) [spring-cloud-stream-binder-rabbit-1.1.1.RELEASE.jar!/:1.1.1.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.cloud.stream.binder.rabbit.RabbitMessageChannelBinder.createProducerDestinationIfNecessary(RabbitMessageChannelBinder.java:85) [spring-cloud-stream-binder-rabbit-1.1.1.RELEASE.jar!/:1.1.1.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.doBindProducer(AbstractMessageChannelBinder.java:98) [spring-cloud-stream-1.1.0.RELEASE.jar!/:1.1.0.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.doBindProducer(AbstractMessageChannelBinder.java:53) [spring-cloud-stream-1.1.0.RELEASE.jar!/:1.1.0.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.cloud.stream.binder.AbstractBinder.bindProducer(AbstractBinder.java:148) [spring-cloud-stream-1.1.0.RELEASE.jar!/:1.1.0.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.cloud.stream.binding.ChannelBindingService.bindProducer(ChannelBindingService.java:113) [spring-cloud-stream-1.1.0.RELEASE.jar!/:1.1.0.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.cloud.stream.binding.BindableProxyFactory.bindOutputs(BindableProxyFactory.java:208) [spring-cloud-stream-1.1.0.RELEASE.jar!/:1.1.0.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.cloud.stream.binding.OutputBindingLifecycle.start(OutputBindingLifecycle.java:57) [spring-cloud-stream-1.1.0.RELEASE.jar!/:1.1.0.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:173) [spring-context-4.3.4.RELEASE.jar!/:4.3.4.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:51) [spring-context-4.3.4.RELEASE.jar!/:4.3.4.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:346) [spring-context-4.3.4.RELEASE.jar!/:4.3.4.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:149) [spring-context-4.3.4.RELEASE.jar!/:4.3.4.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:112) [spring-context-4.3.4.RELEASE.jar!/:4.3.4.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:879) [spring-context-4.3.4.RELEASE.jar!/:4.3.4.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545) [spring-context-4.3.4.RELEASE.jar!/:4.3.4.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at com.example.DemoApplication.main(DemoApplication.java:24) [classes!/:0.0.1-SNAPSHOT] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111-internal] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_111-internal] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_111-internal] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_111-internal] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [app.jar:0.0.1-SNAPSHOT] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [app.jar:0.0.1-SNAPSHOT] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [app.jar:0.0.1-SNAPSHOT] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58) [app.jar:0.0.1-SNAPSHOT] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] Caused by: java.net.ConnectException: Connection refused (Connection refused) 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_111-internal] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_111-internal] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_111-internal] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_111-internal] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_111-internal] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_111-internal] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at com.rabbitmq.client.impl.FrameHandlerFactory.create(FrameHandlerFactory.java:47) ~[amqp-client-3.6.5.jar!/:na] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:822) ~[amqp-client-3.6.5.jar!/:na] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:736) ~[amqp-client-3.6.5.jar!/:na] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:293) ~[spring-rabbit-1.6.5.RELEASE.jar!/:na] 2016-11-30T22:24:01.016+05:30 [APP/0] [OUT] ... 37 common frames omitted 2016-11-30T22:24:01.051+05:30 [APP/0] [OUT] 2016-11-30 16:54:01.051 INFO 12 --- [ main] osintegration.channel.DirectChannel : Channel 'demo-application:production:0.springCloudBusOutput' has 1 subscriber(s). 

Dado que todos los services se inyectan en PCF a través de VCAP_SERVICES mi pensamiento era que no debería haber diferencia en cómo se resuelven / vinculan los services si las aplicaciones se VCAP_SERVICES través de VCAP_SERVICES o acopladores … Además, la connection refused indica un problema de networking, por lo que Hay algo acerca de los contenedores Docker que funcionan de manera diferente en PCF?

ACTUALIZAR

amqp-utils en ambas versiones e instalé amqp-utils . Luego echo $VCAP_SERVICES seguido por amqp-spy en el intercambio springCloudBus que espera hasta que rompa. Todavía no tengo idea de por qué la bota de spring arrojaría una connection rechazada.

 root@2udd2sffmip:~# echo $VCAP_APPLICATION {"limits":{"fds":16384,"mem":256,"disk":512},"application_name":"new-openjdk8","application_uris":["new-openjdk8.local.pcfdev.io"],"name":"new-openjdk8","space_name":"dev","spac e_id":"87680353-58ca-4250-84d1-91d1955acee1","uris":["new-openjdk8.local.pcfdev.io"],"application_id":"9c1244b5-70a1-4275-8d0d-bf9b54958054","version":"9710aaf6-588f-41b8-964d-3 422c6fb525d","application_version":"9710aaf6-588f-41b8-964d-3422c6fb525d"} root@2udd2sffmip:~# echo $VCAP_SERVICES {"p-rabbitmq":[{ "cnetworkingentials": { "http_api_uris": [ "https://13f80867-b5cb-4f36-a689-9c4215a79ef7:if4odk9jshcda7sn74vss8vlh0@rabbitmq-management.local.pcfdev.io/api/" ], "ssl": false, "dashboard_url": "https://rabbitmq-management.local.pcfdev.io/#/login/13f80867-b5cb-4f36-a689-9c4215a79ef7/if4odk9jshcda7sn74vss8vlh0", "password": "if4odk9jshcda7sn74vs s8vlh0", "protocols": { "management": { "path": "/api/", "ssl": false, "hosts": [ "rabbitmq.local.pcfdev.io" ], "password": "if4odk9jshcda7sn74vss8vlh0", "username": "13f80867-b 5cb-4f36-a689-9c4215a79ef7", "port": 15672, "host": "rabbitmq.local.pcfdev.io", "uri": "http://13f80867-b5cb-4f36-a689-9c4215a79ef7:if4odk9jshcda7sn74vss8vlh0@rabbitmq.local.pcf dev.io:15672/api/", "uris": [ "http://13f80867-b5cb-4f36-a689-9c4215a79ef7:if4odk9jshcda7sn74vss8vlh0@rabbitmq.local.pcfdev.io:15672/api/" ] }, "amqp": { "vhost": "2fb4345b-9268 -4865-8340-98e949067d8d", "username": "13f80867-b5cb-4f36-a689-9c4215a79ef7", "password": "if4odk9jshcda7sn74vss8vlh0", "port": 5672, "host": "rabbitmq.local.pcfdev.io", "hosts" : [ "rabbitmq.local.pcfdev.io" ], "ssl": false, "uri": "amqp://13f80867-b5cb-4f36-a689-9c4215a79ef7:if4odk9jshcda7sn74vss8vlh0@rabbitmq.local.pcfdev.io:5672/2fb4345b-9268-4865-8 340-98e949067d8d", "uris": [ "amqp://13f80867-b5cb-4f36-a689-9c4215a79ef7:if4odk9jshcda7sn74vss8vlh0@rabbitmq.local.pcfdev.io:5672/2fb4345b-9268-4865-8340-98e949067d8d" ] } }, " username": "13f80867-b5cb-4f36-a689-9c4215a79ef7", "hostname": "rabbitmq.local.pcfdev.io", "hostnames": [ "rabbitmq.local.pcfdev.io" ], "vhost": "2fb4345b-9268-4865-8340-98e9490 67d8d", "http_api_uri": "https://13f80867-b5cb-4f36-a689-9c4215a79ef7:if4odk9jshcda7sn74vss8vlh0@rabbitmq-management.local.pcfdev.io/api/", "uri": "amqp://13f80867-b5cb-4f36-a68 9-9c4215a79ef7:if4odk9jshcda7sn74vss8vlh0@rabbitmq.local.pcfdev.io/2fb4345b-9268-4865-8340-98e949067d8d", "uris": [ "amqp://13f80867-b5cb-4f36-a689-9c4215a79ef7:if4odk9jshcda7sn 74vss8vlh0@rabbitmq.local.pcfdev.io/2fb4345b-9268-4865-8340-98e949067d8d" ] }, "syslog_drain_url": null, "volume_mounts": [ ], "label": "p-rabbitmq", "provider": null, "plan": " standard", "name": "rabbitmq", "tags": [ "rabbitmq", "messaging", "message-queue", "amqp", "stomp", "mqtt", "pivotal" ] }],"p-config-server":[{ "cnetworkingentials": { "uri": "https:// config-67936b3e-1626-46b6-8117-480654f34e49.local.pcfdev.io", "client_secret": "qSB9z4tI0Vix", "client_id": "p-config-server-f5c46df9-08f0-4779-bac1-3e2096a5efd6", "access_token _uri": "https://p-spring-cloud-services.uaa.local.pcfdev.io/oauth/token" }, "syslog_drain_url": null, "volume_mounts": [ ], "label": "p-config-server", "provider": null, "plan": "standard", "name": "config-server", "tags": [ "configuration", "spring-cloud" ] }]} root@2udd2sffmip:~# /usr/local/bin/amqp-spy -H rabbitmq.local.pcfdev.io -u 13f80867-b5cb-4f36-a689-9c4215a79ef7 --password if4odk9jshcda7sn74vss8vlh0 -V 2fb4345b-9268-4865-8340 -98e949067d8d springCloudBus ^Ccan't be called from trap context 

@Raghu de los loggings que ha publicado después parece que el perfil activo no parece include 'nube', que es la key para la reconfiguration y el enlace de su aplicación al service rabbitmq.