1. 程式人生 > >springboot連線不了Rabbitmq問題

springboot連線不了Rabbitmq問題

問題

Rabbitmq是搭建在虛擬機器上,在管理頁面登入成功,同時建立了個新使用者,也賦予許可權,如圖
在這裡插入圖片描述
但是在springboot整合過程中,卻發現連線不了問題,度娘一番無果,百思不得其解,問題如下:

2018-12-18 09:35:30 29055 [SimpleAsyncTaskExecutor-1] ERROR o.s.a.r.l.SimpleMessageListenerContainer - Failed to check/redeclare auto-delete queue(s). 
org.springframework.amqp.AmqpIOException:
java.io.IOException at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:71) at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:368) at org.springframework.
amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:573) at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1430) at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1411) at org.springframework.
amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1387) at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.java:336) at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.redeclareElementsIfNecessary(SimpleMessageListenerContainer.java:1171) at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1422) at java.lang.Thread.run(Thread.java:748) Caused by: java.io.IOException: null at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:105) at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:101) at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:353) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:909) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:859) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1013) at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:356) ... 8 common frames omitted

配置如下:

  rabbitmq:
    host: 192.168.153.133
    port: 15672
    username: lss
    password: 888888
    virtual-host: /

後把埠改成5672,發現問題消失 …