인프런 커뮤니티 질문&답변

Truestar님의 프로필 이미지
Truestar

작성한 질문수

Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)

Configuration Service

도커로 실행된 config-service 의 `rabbitmq:5672` bind Exception

해결된 질문

작성

·

4.8K

0

안녕하세요 강사님.
제가 놓친것이 있는지 아래에 보시는바와 같이 rabbitmq:5672 에 연결을 못하는것 같습니다
재차 틀린부분을 검토했으나, 알수가 없네요..

  • 아래는 `config-service` 로그 내용입니다
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.4.6)

2021-06-19 02:07:59.458  INFO 1 --- [           main] c.e.c.ConfigServiceApplication           : The following profiles are active: default
2021-06-19 02:08:00.698  INFO 1 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=bc9f3347-c72c-3e7c-b9c9-e642fc88c55a
2021-06-19 02:08:00.712  INFO 1 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
2021-06-19 02:08:00.721  INFO 1 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'taskScheduler' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.
2021-06-19 02:08:00.727  INFO 1 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
2021-06-19 02:08:00.782  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.stream.config.BindersHealthIndicatorAutoConfiguration' of type [org.springframework.cloud.stream.config.BindersHealthIndicatorAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-06-19 02:08:00.786  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'bindersHealthContributor' of type [org.springframework.cloud.stream.config.BindersHealthIndicatorAutoConfiguration$BindersHealthContributor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-06-19 02:08:00.787  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'bindersHealthIndicatorListener' of type [org.springframework.cloud.stream.config.BindersHealthIndicatorAutoConfiguration$BindersHealthIndicatorListener] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-06-19 02:08:00.798  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.integration.config.IntegrationManagementConfiguration' of type [org.springframework.integration.config.IntegrationManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-06-19 02:08:00.809  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationChannelResolver' of type [org.springframework.integration.support.channel.BeanFactoryChannelResolver] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-06-19 02:08:00.811  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationDisposableAutoCreatedBeans' of type [org.springframework.integration.config.annotation.Disposables] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-06-19 02:08:01.135  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8888 (http)
2021-06-19 02:08:01.147  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-06-19 02:08:01.148  INFO 1 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.46]
2021-06-19 02:08:01.206  INFO 1 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-06-19 02:08:01.206  INFO 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1726 ms
2021-06-19 02:08:02.745  INFO 1 --- [           main] o.s.c.s.m.DirectWithAttributesChannel    : Channel 'application-1.springCloudBusInput' has 1 subscriber(s).
2021-06-19 02:08:02.969  INFO 1 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2021-06-19 02:08:03.050  INFO 1 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2021-06-19 02:08:03.051  INFO 1 --- [           main] o.s.i.channel.PublishSubscribeChannel    : Channel 'application-1.errorChannel' has 1 subscriber(s).
2021-06-19 02:08:03.051  INFO 1 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : started bean '_org.springframework.integration.errorLogger'
2021-06-19 02:08:03.053  INFO 1 --- [           main] o.s.c.s.binder.DefaultBinderFactory      : Creating binder: rabbit
2021-06-19 02:08:03.153  INFO 1 --- [           main] o.s.c.s.binder.DefaultBinderFactory      : Caching the binder: rabbit
2021-06-19 02:08:03.154  INFO 1 --- [           main] o.s.c.s.binder.DefaultBinderFactory      : Retrieving cached binder: rabbit
2021-06-19 02:08:03.221  INFO 1 --- [           main] c.s.b.r.p.RabbitExchangeQueueProvisioner : declaring queue for inbound: springCloudBus.anonymous.4wzOdw47Sy26wph_F05ySw, bound to: springCloudBus
2021-06-19 02:08:03.226  INFO 1 --- [           main] o.s.a.r.c.CachingConnectionFactory       : Attempting to connect to: [rabbitmq:5672]
2021-06-19 02:08:03.292  WARN 1 --- [172.18.0.2:5672] c.r.c.impl.ForgivingExceptionHandler     : An unexpected connection driver error occured (Exception message: Socket closed)
2021-06-19 02:08:03.294  INFO 1 --- [           main] o.s.a.r.c.CachingConnectionFactory       : Attempting to connect to: [rabbitmq:5672]
2021-06-19 02:08:03.298  WARN 1 --- [172.18.0.2:5672] c.r.c.impl.ForgivingExceptionHandler     : An unexpected connection driver error occured (Exception message: Socket closed)
2021-06-19 02:08:03.301  INFO 1 --- [           main] o.s.a.r.c.CachingConnectionFactory       : Attempting to connect to: [rabbitmq:5672]
2021-06-19 02:08:03.305  WARN 1 --- [172.18.0.2:5672] c.r.c.impl.ForgivingExceptionHandler     : An unexpected connection driver error occured (Exception message: Socket closed)
2021-06-19 02:08:03.339  INFO 1 --- [           main] o.s.c.stream.binder.BinderErrorChannel   : Channel 'springCloudBus.anonymous.4wzOdw47Sy26wph_F05ySw.errors' has 1 subscriber(s).
2021-06-19 02:08:03.340  INFO 1 --- [           main] o.s.c.stream.binder.BinderErrorChannel   : Channel 'springCloudBus.anonymous.4wzOdw47Sy26wph_F05ySw.errors' has 2 subscriber(s).
2021-06-19 02:08:03.343  INFO 1 --- [           main] o.s.a.r.c.CachingConnectionFactory       : Attempting to connect to: [rabbitmq:5672]
2021-06-19 02:08:03.353  INFO 1 --- [           main] o.s.a.r.l.SimpleMessageListenerContainer : Broker not available; cannot force queue declarations during start: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
2021-06-19 02:08:03.353  WARN 1 --- [172.18.0.2:5672] c.r.c.impl.ForgivingExceptionHandler     : An unexpected connection driver error occured (Exception message: Socket closed)
2021-06-19 02:08:03.366  INFO 1 --- [y26wph_F05ySw-1] o.s.a.r.c.CachingConnectionFactory       : Attempting to connect to: [rabbitmq:5672]
2021-06-19 02:08:03.371  WARN 1 --- [172.18.0.2:5672] c.r.c.impl.ForgivingExceptionHandler     : An unexpected connection driver error occured (Exception message: Socket closed)
2021-06-19 02:08:03.376 ERROR 1 --- [y26wph_F05ySw-1] o.s.a.r.l.SimpleMessageListenerContainer : Consumer received fatal exception on startup

org.springframework.amqp.rabbit.listener.exception.FatalListenerStartupException: Authentication failure
	at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:602) ~[spring-rabbit-2.3.7.jar!/:2.3.7]
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.initialize(SimpleMessageListenerContainer.java:1348) ~[spring-rabbit-2.3.7.jar!/:2.3.7]
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1193) ~[spring-rabbit-2.3.7.jar!/:2.3.7]
	at java.base/java.lang.Thread.run(Thread.java:831) ~[na:na]
Caused by: org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
	at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:64) ~[spring-rabbit-2.3.7.jar!/:2.3.7]
	at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:602) ~[spring-rabbit-2.3.7.jar!/:2.3.7]
	at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:724) ~[spring-rabbit-2.3.7.jar!/:2.3.7]
	at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.createConnection(ConnectionFactoryUtils.java:216) ~[spring-rabbit-2.3.7.jar!/:2.3.7]
	at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$RabbitResourceFactory.createConnection(ConnectionFactoryUtils.java:295) ~[spring-rabbit-2.3.7.jar!/:2.3.7]
	at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:130) ~[spring-rabbit-2.3.7.jar!/:2.3.7]
	at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:92) ~[spring-rabbit-2.3.7.jar!/:2.3.7]
	at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:75) ~[spring-rabbit-2.3.7.jar!/:2.3.7]
	at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:596) ~[spring-rabbit-2.3.7.jar!/:2.3.7]
	... 3 common frames omitted
Caused by: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
	at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:385) ~[amqp-client-5.10.0.jar!/:5.10.0]
	at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1139) ~[amqp-client-5.10.0.jar!/:5.10.0]
	at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1087) ~[amqp-client-5.10.0.jar!/:5.10.0]
	at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.connectAddresses(AbstractConnectionFactory.java:640) ~[spring-rabbit-2.3.7.jar!/:2.3.7]
	at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.connect(AbstractConnectionFactory.java:615) ~[spring-rabbit-2.3.7.jar!/:2.3.7]
	at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:565) ~[spring-rabbit-2.3.7.jar!/:2.3.7]
	... 10 common frames omitted

  • 아래와 같이  네트워크에도 잘 뜨구요

설정 부분이 미미하게 다르긴 하나, 맥락이 틀리진 않았던것 같은데요..
제가 혹시 제가 놓친 부분이 있을까요?
혹시 몰라서 이메일에 소스를 넣어드렸습니다

읽어주셔서 감사합니다.

답변 1

4

Dowon Lee님의 프로필 이미지
Dowon Lee
지식공유자

안녕하세요, 이도원입니다. 

config-service에서 rabbitmq에 접속하지 못하는 원인은, 로그 메시지를 봤을 때 인증이 되지 않는 것 같습니다. rabbitmq의 로그인 정보에 문제가 있지 않았나 싶습니다. 기본 설치 시 guest/guest 이런 식으로 되어 있는데, 혹시 변경 사항이 있었는지 확인해 보시기 바랍니다. rabbitmq 서비스를 기동하신 뒤에 http://127.0.0.1:15672 으로 접속하셔서 인증이 되시는지 확인해 보시기 바랍니다. 

감사합니다. 

Truestar님의 프로필 이미지
Truestar
질문자

답변 감사드립니다.
새로운 지식이 과거의 지식을 덮는다는 말이 있다는데
딱 제 상황에 해당되는것 같습니다..ㅎㅎㅎ

다행히 지난 시간에 RabbitMQ ID/PW 를 브라우저에 저장한 상태였지요.
알려주신 링크로 들어가자마자 브라우저가 ID/PW 인풋 폼에 체워준 문자열이 `admin` `******` 였네요;;

  • 원인:
    - Docker 배우면서 설정한 Docker run 명령어의 RabbitMQ Account 정보 와
    MSA  application.yml 의  RabbitMQ Account 정보가 상이함.



  • 해결: Docker RabbitMQ 컨테이너  실행 명령어 수정
    - guest/guest 를 admin/test1234 로 변경

너무 해매여서 힘이 빠질 찰나에 명확히 짚어주셨어요.
정말 감사합니다.
또한 안일히 생각했던 부분을 되짚는 계기가 되었습니다
Hoxy 저와 같은 고민을 하실 분들을위해 남겨놓았습니다!

친절하신 답변 감사드립니다!

Truestar님의 프로필 이미지
Truestar

작성한 질문수

질문하기