org.springframework.amqp.AmqpConnectException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • It is not necessary that rabbit mq servers are running while the consumer application is being started. If connection is not possible, it should postpone it later on, for example 5 minutes later. Error creating bean with name 'org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer#0' defined in class path resou rce [com/yamanyar/def/publisher/spring-def-core.xml]: Invocation of init method failed; nested exception is org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Con nection refused at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) ... Caused by: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused at org.springframework.amqp.rabbit.support.RabbitUtils.convertRabbitAccessException(RabbitUtils.java:111) at org.springframework.amqp.rabbit.support.RabbitAccessor.convertRabbitAccessException(RabbitAccessor.java:135) at org.springframework.amqp.rabbit.listener.AbstractRabbitListeningContainer.initialize(AbstractRabbitListeningContainer.java:137) at org.springframework.amqp.rabbit.listener.AbstractRabbitListeningContainer.afterPropertiesSet(AbstractRabbitListeningContainer.java:99) at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.afterPropertiesSet(SimpleMessageListenerContainer.java:143) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) ... 36 more Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:529) at java.net.Socket.connect(Socket.java:478) at com.rabbitmq.client.ConnectionFactory.createFrameHandler(ConnectionFactory.java:338) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:376) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:399) at org.springframework.amqp.rabbit.connection.SingleConnectionFactory.doCreateConnection(SingleConnectionFactory.java:198) at org.springframework.amqp.rabbit.connection.SingleConnectionFactory.initConnection(SingleConnectionFactory.java:144) at org.springframework.amqp.rabbit.connection.SingleConnectionFactory.createConnection(SingleConnectionFactory.java:133) at org.springframework.amqp.rabbit.support.RabbitAccessor.createConnection(RabbitAccessor.java:89) at org.springframework.amqp.rabbit.listener.AbstractRabbitListeningContainer.createSharedConnection(AbstractRabbitListeningContainer.java:312) at org.springframework.amqp.rabbit.listener.AbstractRabbitListeningContainer.establishSharedConnection(AbstractRabbitListeningContainer.java:286) at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doInitialize(SimpleMessageListenerContainer.java:181) at org.springframework.amqp.rabbit.listener.AbstractRabbitListeningContainer.initialize(AbstractRabbitListeningContainer.java:132) ... 40 more
    via by Kaan Yamanyar,
  • It is not necessary that rabbit mq servers are running while the consumer application is being started. If connection is not possible, it should postpone it later on, for example 5 minutes later. Error creating bean with name 'org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer#0' defined in class path resou rce [com/yamanyar/def/publisher/spring-def-core.xml]: Invocation of init method failed; nested exception is org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Con nection refused at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) ... Caused by: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused at org.springframework.amqp.rabbit.support.RabbitUtils.convertRabbitAccessException(RabbitUtils.java:111) at org.springframework.amqp.rabbit.support.RabbitAccessor.convertRabbitAccessException(RabbitAccessor.java:135) at org.springframework.amqp.rabbit.listener.AbstractRabbitListeningContainer.initialize(AbstractRabbitListeningContainer.java:137) at org.springframework.amqp.rabbit.listener.AbstractRabbitListeningContainer.afterPropertiesSet(AbstractRabbitListeningContainer.java:99) at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.afterPropertiesSet(SimpleMessageListenerContainer.java:143) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) ... 36 more Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:529) at java.net.Socket.connect(Socket.java:478) at com.rabbitmq.client.ConnectionFactory.createFrameHandler(ConnectionFactory.java:338) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:376) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:399) at org.springframework.amqp.rabbit.connection.SingleConnectionFactory.doCreateConnection(SingleConnectionFactory.java:198) at org.springframework.amqp.rabbit.connection.SingleConnectionFactory.initConnection(SingleConnectionFactory.java:144) at org.springframework.amqp.rabbit.connection.SingleConnectionFactory.createConnection(SingleConnectionFactory.java:133) at org.springframework.amqp.rabbit.support.RabbitAccessor.createConnection(RabbitAccessor.java:89) at org.springframework.amqp.rabbit.listener.AbstractRabbitListeningContainer.createSharedConnection(AbstractRabbitListeningContainer.java:312) at org.springframework.amqp.rabbit.listener.AbstractRabbitListeningContainer.establishSharedConnection(AbstractRabbitListeningContainer.java:286) at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doInitialize(SimpleMessageListenerContainer.java:181) at org.springframework.amqp.rabbit.listener.AbstractRabbitListeningContainer.initialize(AbstractRabbitListeningContainer.java:132) ... 40 more
    via by Kaan Yamanyar,
    • org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Con nection refused at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    No Bugmate found.