jiamengke 2016-10-24 02:41 采纳率: 0%
浏览 21338
已结题

spring整合RabbitMQ出现的异常

tomcat启动一会就一直报下面的异常。请问有没有遇到过相同的问题啊,是如何解决的?
[2016-10-24 10:41:13,541] INFO413727(org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer:run) - Restarting Consumer: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
[2016-10-24 10:41:13,541]DEBUG413727(org.springframework.amqp.rabbit.listener.BlockingQueueConsumer:stop) - Closing Rabbit Channel: null
[2016-10-24 10:41:13,542]DEBUG413728(org.springframework.beans.factory.support.AbstractBeanFactory:doGetBean) - Returning cached instance of singleton bean 'logMessageQueue'
[2016-10-24 10:41:13,542]DEBUG413728(org.springframework.amqp.rabbit.listener.BlockingQueueConsumer:start) - Starting consumer Consumer: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
[2016-10-24 10:41:18,546]DEBUG418732(org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer:handleStartupFailure) - Recovering consumer in 5000 ms.
[2016-10-24 10:41:23,557] WARN423743(org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer:logConsumerException) - Consumer raised exception, processing can restart if the connection factory supports it
java.util.concurrent.TimeoutException
at com.rabbitmq.utility.BlockingCell.get(BlockingCell.java:77)
at com.rabbitmq.utility.BlockingCell.uninterruptibleGet(BlockingCell.java:111)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:37)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:367)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:293)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:813)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:767)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:887)
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:191)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:371)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.java:80)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:130)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:67)
at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:365)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1009)
at java.lang.Thread.run(Thread.java:745)
[2016-10-24 10:41:23,557] INFO423743(org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer:run) - Restarting Consumer: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
[2016-10-24 10:41:23,558]DEBUG423744(org.springframework.amqp.rabbit.listener.BlockingQueueConsumer:stop) - Closing Rabbit Channel: null
[2016-10-24 10:41:23,558]DEBUG423744(org.springframework.beans.factory.support.AbstractBeanFactory:doGetBean) - Returning cached instance of singleton bean 'logMessageQueue'
[2016-10-24 10:41:23,558]DEBUG423744(org.springframework.amqp.rabbit.listener.BlockingQueueConsumer:start) - Starting consumer Consumer: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
[2016-10-24 10:41:28,560]DEBUG428746(org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer:handleStartupFailure) - Recovering consumer in 5000 ms.
下面是我的spring-mq.xml文件
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/rabbit
http://www.springframework.org/schema/rabbit/spring-rabbit-1.2.xsd">
<!-- 连接服务配置 -->

host="localhost" username="guest" password="guest" port="15672" />

 <!-- queue 队列声明-->
<rabbit:queue id="logMessageQueue" durable="true" auto-delete="false" exclusive="false" name="logMessageQueue"/>

<!-- exchange queue binging key 绑定 -->
<rabbit:direct-exchange name="message_exchange" durable="true" auto-delete="false" id="message_exchange">
    <rabbit:bindings>
        <rabbit:binding queue="logMessageQueue" key="logMessageQueue"/>
    </rabbit:bindings>
</rabbit:direct-exchange>

<!-- spring amqp默认的是jackson 的一个插件,目的将生产者生产的数据转换为json存入消息队列,由于fastjson的速度快于jackson,这里替换为fastjson的一个实现 -->
<bean id="jsonMessageConverter"  class="com.shixu.common.rabbitmq.FastJsonMessageConverter"></bean>

<!-- spring template声明 -->
/rabbit:template

<!-- 消息接受者 -->
<bean id="queueOneLitener" class="com.shixu.common.rabbitmq.QueueOneLitener"></bean>

<!-- queue litener  观察 监听模式 当有消息到达时会通知监听在对应的队列上的监听对象 taskExecutor这个需要自己实现一个连接池 按照官方说法 除非特别大的数据量 一般不需要连接池-->
<rabbit:listener-container connection-factory="connectionFactory" acknowledge="auto" >
    <rabbit:listener queues="logMessageQueue" ref="queueOneLitener"/>
</rabbit:listener-container>
  • 写回答

3条回答 默认 最新

  • quit326575 2017-08-19 03:42
    关注

    rabbitmq的web访问地址是15672,正常的消息发送端口是5672,把配置内port=15672修改为5672

    评论

报告相同问题?

悬赏问题

  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办