RabbitMQ new connection refused due to SocketException

回眸只為那壹抹淺笑 提交于 2019-12-03 11:27:26

One of the possible reasons is that user you are connecting with to RabbitMQ has no rights to access to virtual hosts.

You can check this using Management Plugin (Admin tab).

  • Do not specify the default port as you have mentioned in your steps.

  • If you have not created virtual host on the actual server, where you are trying to connect, Do create a virtual host and give it admin permision.

  • Set the virtual host on the factory before creating the new connection, like factory.setVirtualHost("VIRTUAL_HOST_NAME_ON_SERVER");

  • Make sure username on the server on which you are trying to connect is Admin and have access to the Virtual Host you just created.

  • Specify your username and password along with virtual host, while getting the connection.

  • Start your application in Debug Mode, and check if it now passes, factory.newConection();

This should make your things work. Got the same exception, and it worked for me.

If it still does not work paste your code snippet.

You can check if the SSL/TLS support is enabled. Then use the instruction useSslProtocol :

ConnectionFactory factory = new ConnectionFactory();
factory.useSslProtocol();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!