Spring AMQP + RabbitMQ 3.3.5 ACCESS_REFUSED - 認証メカニズムPLAINを使用したログインが拒否されました 質問する

Spring AMQP + RabbitMQ 3.3.5 ACCESS_REFUSED - 認証メカニズムPLAINを使用したログインが拒否されました 質問する

例外を下回っています

org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - 認証メカニズム PLAIN を使用したログインが拒否されました。詳細については、ブローカーのログファイルを参照してください。

構成: Windows 上の RabbitMQ 3.3.5

Configファイルでは、%APPDATA%\RabbitMQ\rabbit.config以下のように変更しました。https://www.rabbitmq.com/access-control.html

[{rabbit, [{loopback_users, []}]}].

また、user/pwd の作成も試みましたが、test/test では機能しないようです。

の手順を試しましたこれ役職。

その他の構成の詳細は次のとおりです。

Tomcat ホスト Spring アプリケーション コンテキスト:

<!-- Rabbit MQ configuration Start -->
    <!-- Connection Factory -->
    <rabbit:connection-factory id="rabbitConnFactory" virtual-host="/" username="guest" password="guest" port="5672"/>

    <!-- Spring AMQP Template -->
    <rabbit:template id="rabbitTemplate" connection-factory="rabbitConnFactory" routing-key="ecl.down.queue" queue="ecl.down.queue" />

    <!-- Spring AMQP Admin -->
    <rabbit:admin id="admin" connection-factory="rabbitConnFactory"/>

    <rabbit:queue id="ecl.down.queue" name="ecl.down.queue" />

    <rabbit:direct-exchange name="ecl.down.exchange">
        <rabbit:bindings>
            <rabbit:binding key="ecl.down.key" queue="ecl.down.queue"/>
        </rabbit:bindings>
    </rabbit:direct-exchange>

私のコントローラークラスでは

@Autowired
RmqMessageSender rmqMessageSender;

//Inside a method
rmqMessageSender.submitToECLDown(orderInSession.getOrderNo());

私のメッセージの送信者:

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("messageSender")
public class RmqMessageSender  {

    @Autowired
    AmqpTemplate                rabbitTemplate;

    public void submitToRMQ(String orderId){
        try{
            rabbitTemplate.convertAndSend("Hello World");
        } catch (Exception e){
            LOGGER.error(e.getMessage());
        }
    }       
}

上記の例外ブロックは下記の例外を発生します


org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - 認証メカニズム PLAIN を使用したログインが拒否されました。詳細については、ブローカーのログファイルを参照してください。


エラーログ

  =ERROR REPORT==== 7-Nov-2014::18:04:37 ===
closing AMQP connection <0.489.0> (10.1.XX.2XX:52298 -> 10.1.XX.2XX:5672):
    {handshake_error,starting,0,
                     {amqp_error,access_refused,
                                 "PLAIN login refused: user 'guest' can only connect via localhost",
                                 'connection.start_ok'}}

pom.xmlのエントリを以下で確認してください

        <dependency>
            <groupId>org.springframework.amqp</groupId>
            <artifactId>spring-rabbit</artifactId>
            <version>1.3.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-amqp</artifactId>
            <version>4.0.4.RELEASE</version>
        </dependency>

ご意見やご提案がありましたらお知らせください

ベストアンサー1

アルテム・ビランの説明は正しいと思うこここのエラーの原因の 1 つとして以下が考えられます:

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

しかし、私にとっての解決策は、rabbitMQ管理ページにログインすることでした(http://localhost:15672/#/ユーザー) をデフォルトのユーザー名とパスワードである guest/guest でログインし、新しいユーザーを追加し、その新しいユーザーに対して仮想ホストからアクセスする権限を有効にして、デフォルトの guest の代わりに新しいユーザー名とパスワードを使用したところ、エラーが解消されました。

ここに画像の説明を入力してください

おすすめ記事