专栏首页别先生如何解决eclipse远程服务器上面的Rabbitmq连接超时问题?

如何解决eclipse远程服务器上面的Rabbitmq连接超时问题?

1、嗯,问题呢,就是一开始安装好RabbitMQ,练习了一下RabbitMQ的使用,但是呢,过了一段时间,我来复习的时候,发现运行出现下面的错误了。后来想想,是自己学习微服务的时候,修改了/etc/hosts的映射。后来又修改回去了,是不是感觉日了?了。解决方法如下所示:

eclipse远程连接服务器上面的Rabbitmq报的错误如下所示:

 1 org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect
 2     at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:62) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
 3     at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:509) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
 4     at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:684) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
 5     at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.createConnection(ConnectionFactoryUtils.java:214) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
 6     at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1961) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
 7     at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1935) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
 8     at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1916) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
 9     at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.java:393) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
10     at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.redeclareElementsIfNecessary(AbstractMessageListenerContainer.java:1722) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
11     at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1026) [spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
12     at java.lang.Thread.run(Unknown Source) [na:1.8.0_191]
13 Caused by: java.net.ConnectException: Connection refused: connect
14     at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_191]
15     at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) ~[na:1.8.0_191]
16     at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[na:1.8.0_191]
17     at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[na:1.8.0_191]
18     at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[na:1.8.0_191]
19     at java.net.PlainSocketImpl.connect(Unknown Source) ~[na:1.8.0_191]
20     at java.net.SocksSocketImpl.connect(Unknown Source) ~[na:1.8.0_191]
21     at java.net.Socket.connect(Unknown Source) ~[na:1.8.0_191]
22     at com.rabbitmq.client.impl.SocketFrameHandlerFactory.create(SocketFrameHandlerFactory.java:60) ~[amqp-client-5.4.3.jar:5.4.3]
23     at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1102) ~[amqp-client-5.4.3.jar:5.4.3]
24     at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1054) ~[amqp-client-5.4.3.jar:5.4.3]
25     at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:994) ~[amqp-client-5.4.3.jar:5.4.3]
26     at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:462) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
27     ... 9 common frames omitted
28 
29 2019-11-21 22:54:45.267  INFO 19532 --- [TaskExecutor-25] o.s.a.r.c.CachingConnectionFactory       : Attempting to connect to: [192.168.110.133:5672]
30 2019-11-21 22:54:49.261  WARN 19532 --- [TaskExecutor-24] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect
31 2019-11-21 22:54:49.261  INFO 19532 --- [TaskExecutor-24] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@3d06980: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
32 2019-11-21 22:54:49.262  INFO 19532 --- [TaskExecutor-25] o.s.a.r.c.CachingConnectionFactory       : Attempting to connect to: [192.168.110.133:5672]
33 2019-11-21 22:54:50.266 ERROR 19532 --- [TaskExecutor-25] o.s.a.r.l.SimpleMessageListenerContainer : Failed to check/redeclare auto-delete queue(s).

我修改的etc/hosts配置文件如下所示:

然后你再次使用eclipse远程访问rabbitmq的时候,应该已经正常了,未修改回来之前,我点击Rabbitmq的管控台overview的时候,反应超级慢的,改回来以后反应很快哦。 作者:别先生 博客园:https://www.cnblogs.com/biehongli/

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • ElasticSearch安装中文分词器IK

    1、安装IK分词器,下载对应版本的插件,elasticsearch-analysis-ik中文分词器的开发者一直进行维护的,对应着elasticsearch的版...

    别先生
  • 005-Spring Boot配置分析-配置文件application、EnvironmentPostProcessor、Profiles

    默认配置文件application.propertie或者application.yml,可同时存在

    别先生
  • 基于jsp+servlet图书管理系统之后台用户信息删除操作

    上一篇的博客写的是修改操作,且附有源码和数据库,这篇博客写的是删除操作,附有从头至尾写的代码(详细的注释)和数据库!   此次删除操作的源码和数据库:http:...

    别先生
  • pd_ds中的hash

    前言 在c++的STL中,提供了一种hash函数,其用法和map是几乎一样的,但是速度却能快接近一倍 使用方法 需要的头文件 #include<ext/pb_d...

    attack
  • Redash调研

    俗话说“工欲善其事必先利其器”,今天跟大家一起交流一款简单易用的数据查询和可视化分析的开源BI工具Redash。

    用户6021891
  • 百度搜索带来的异常留资,你认为出现了什么情况?

    异常的表现是,这个月开始,来自百度搜索的留资电话的数量显著上升了,大家还正高兴呢,另一个数据却泼了凉水。

    iCDO互联网数据官
  • 多线程设计模式 - Future模式之JAVA原生实现

    JDK内置的Future设计模式主要使用到了Callable接口和FutureTask类。

    JAVA日知录
  • [739]flask-mail发送邮件

    这里我以QQ邮箱为例,来讲解QQ邮箱的发送!其它邮箱与此类似(下图是QQ邮箱服务器地址、端口号相关信息)

    周小董
  • 锤子分拆VR业务,这是憋大招呢还是黔驴技穷?

    镁客网
  • 机器学习的平台化发展趋势

    机器学习在经过近些年的野蛮生长之后,其有效性已经被无数成功应用所验证,在这一点上已经不需要更多证明。

    孙玄@奈学教育

扫码关注云+社区

领取腾讯云代金券