I am trying to build a event driven microservice with spring cloud stream using rabbitmq. In my case, rabbitmq is running in docker.
Docker commands used to run below container
docker run -d --hostname my-rabbit --name some-rabbit --publish 15672:15672 rabbitmq:3
Then going to bash mode of container I fired below command:
rabbitmq-plugins enable rabbitmq_management
in order to start management-plugin
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b2bc315c44aa rabbitmq:3 "docker-entrypoint..." 7 minutes ago Up 7 minutes 4369/tcp, 5671-5672/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp some-rabbit
So I can access docker from browser on localhost:15672
But when I start the Spring Boot application it is not making queue and exchange. Please check the stack trace.
Stack-trace
o.s.i.codec.kryo.CompositeKryoRegistrar : configured Kryo registration [40, java.io.File] with serializer org.springframework.integration.codec.kryo.FileSerializer
o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'rabbitConnectionFactory' has been autodetected for JMX exposure
o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'integrationMbeanExporter' has been autodetected for JMX exposure
o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'integrationMbeanExporter': registering with JMX server as MBean [org.springframework.integration.monitor:name=integrationMbeanExporter,type=IntegrationMBeanExporter]
o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'rabbitConnectionFactory': registering with JMX server as MBean [org.springframework.amqp.rabbit.connection:name=rabbitConnectionFactory,type=CachingConnectionFactory]
o.s.i.monitor.IntegrationMBeanExporter : Registering beans for JMX exposure on startup
o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel nullChannel
o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=nullChannel': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=nullChannel]
o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel output
o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=output': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=output]
o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel errorChannel
o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=errorChannel': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=errorChannel]
o.s.i.monitor.IntegrationMBeanExporter : Registering MessageHandler errorLogger
o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageHandler,name=errorLogger,bean=internal': registering with JMX server as MBean [org.springframework.integration:type=MessageHandler,name=errorLogger,bean=internal]
o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase -2147482648
r.t.b.demo.source.GatewayApplication : No active profile set, falling back to default profiles: default
s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@56cfe111: startup date [Mon May 29 15:07:40 JST 2017]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4fe767f3
o.s.c.support.GenericApplicationContext : Refreshing org.springframework.context.support.GenericApplicationContext@67de7a99: startup date [Mon May 29 15:07:40 JST 2017]; root of context hierarchy
r.t.b.demo.source.GatewayApplication : Started GatewayApplication in 0.189 seconds (JVM running for 10.957)
o.s.amqp.rabbit.core.RabbitAdmin : Failed to declare exchange: Exchange [name=output, type=topic, durable=true, autoDelete=false, internal=false, arguments={}], continuing... org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused
o.s.integration.channel.DirectChannel : Channel 'gateway:8181.output' has 1 subscriber(s).
o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
o.s.i.endpoint.EventDrivenConsumer : Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
o.s.i.channel.PublishSubscribeChannel : Channel 'gateway:8181.errorChannel' has 1 subscriber(s).
o.s.i.endpoint.EventDrivenConsumer : started _org.springframework.integration.errorLogger
o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147482647
o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647
s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8181 (http)
Thanks in advance.
15672is accessible from the outside. All the other ports aren't exposed. How did you start the container. Also instead of only adding a vague message you want to add the full stack trace / debug information you have. - M. Deinum