当前位置:   article > 正文

Rabbitmq安装及连接错误问题_com.rabbitmq.client.connectionfactory$1$$externals

com.rabbitmq.client.connectionfactory$1$$externalsyntheticlambda0

Rabbitmq连接测试以及本地报错问题

本人在学习spingcloud的时候,学习到消息总线时遇到的问题,
首先需要安装下载Rabbitmq
借鉴这位博主的文章: https://blog.csdn.net/newbie_907486852/article/details/79788471
添加用户修改密码: http://www.cnblogs.com/fjzhang/p/8403979.html

我的配置:
![https://mp.csdn.net](https://img-blog.csdnimg.cn/2018120610113014.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQxOTI5Mjcw,size_16,color_FFFFFF,t_70
host:也可以写成127.0.0.1本机端口。远程请写成自己本地的端口
就是因为我自己新添加的用户没有修改权限就出现了第三种错误:

找了好多资料,看到了这个:
https://blog.csdn.net/java_xiaobin/article/details/46964805

1、如果写错了host (如:factory.setHost(“locathost”); )报错

Exception in thread “main” java.net.UnknownHostException: locathost
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:195)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at com.rabbitmq.client.impl.FrameHandlerFactory.create(FrameHandlerFactory.java:32)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:588)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:612)
at com.aaa.test.Send.main(Send.java:19)

2 、如果写错了HOST的IP(如:factory.setHost(“192.168.1.10”); )无此地址, 报错:

Exception in thread “main” java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at com.rabbitmq.client.impl.FrameHandlerFactory.create(FrameHandlerFactory.java:32)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:588)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:612)

3、如果写错端口PORT(如:factory.setPort(5678);) 报错:

Exception in thread “main” java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at com.rabbitmq.client.impl.FrameHandlerFactory.create(FrameHandlerFactory.java:32)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:588)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:612)
at com.aaa.test.Send.main(Send.java:19)

4、如果写错用户名或者密码,报错:

Exception in thread “main” 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:338)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:590)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:612)
at com.aaa.test.Send.main(Send.java:19)

5、解决方法

1.首先点击用户
图片: ![https://avatar.csdn.net/7/7/B/1_ralf_hx163com.jpg](https://img-blog.csdnimg.cn/20181206103228376.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQxOTI5Mjcw,size_16,color_FFFFFF,t_70

2.点击自己注册的用户名
图片:
在这里插入图片描述

3.点击Set permission进行授权
图片:
在这里插入图片描述

嗯哼,完成!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/559780
推荐阅读
相关标签
  

闽ICP备14008679号