gpt4 book ai didi

java - 拒绝访问 - 使用身份验证机制 PLAIN RabbitMQ 队列拒绝登录

转载 作者:行者123 更新时间:2023-12-05 04:08:09 29 4
gpt4 key购买 nike

我正在尝试使用 RabbitMQ 从一个应用程序发布消息并在另一个应用程序中接收它们。我可以使用本地主机发布消息。

ex:  amqp://guest:guest@localhost:5672

当我尝试使用不同的 Ip 发布消息时出现以下异常。

com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED-Login was refused using authentication mechanism PLAIN. For details see the broker logfile.

示例代码:

private  Connection getConnection(){
Connection connection = null;
try {
ConnectionFactory factory = new ConnectionFactory();
final URI uri = URI.create(PropertyReader.read("rabbit.mq.uri").trim());
factory.setConnectionTimeout(30000);
factory.setAutomaticRecoveryEnabled(true);
factory.setTopologyRecoveryEnabled(true);
factory.setNetworkRecoveryInterval(10000);
factory.setExceptionHandler(new DefaultExceptionHandler());
factory.setRequestedHeartbeat(360);
factory.setUri(uri);

connection = factory.newConnection();
LOGGER.info("Rabbit MQ Connection established successfully");
} catch (Exception e) {
LOGGER.error("Error { }"+e);
}
return connection;
}

我需要帮助。

使用 telnet 我检查了提供的 Ip。

最佳答案

默认情况下,guest 用户只能连接到 localhost:see the documentation .

"guest" user can only connect via localhost

By default, the guest user is prohibited from connecting to the broker remotely; it can only connect over a loopback interface (i.e. localhost). This applies both to AMQP 0-9-1 and to any other protocols enabled via plugins. Any other users you create will not (by default) be restricted in this way.

This is configured via the loopback_users item in the configuration file.

If you wish to allow the guest user to connect from a remote host, you should set the loopback_users configuration to none.

...

关于java - 拒绝访问 - 使用身份验证机制 PLAIN RabbitMQ 队列拒绝登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47883024/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com