title: Spring AMQP + RabbitMQ 3.3.5 ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN
body: <p>I am getting below exception</p>
  
  <blockquote>
    <p>org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.</p>
  </blockquote>
  
  <p>Configuration: RabbitMQ 3.3.5 on windows</p>
  
  <p>On Config file in <code>%APPDATA%\RabbitMQ\rabbit.config</code>
  I have done below change as per <a href="https://www.rabbitmq.com/access-control.html" rel="noreferrer">https://www.rabbitmq.com/access-control.html</a></p>
  
  <pre><code>[{rabbit, [{loopback_users, []}]}].
  </code></pre>
  
  <p>I also tried creating a user/pwd - test/test doesn't seem to make it work.</p>
  
  <p>Tried the Steps from <a href="https://stackoverflow.com/questions/23784080/rabbitmq-guest-login-failed">this</a> post.</p>
  
  <p>Other Configuration Details are as below:</p>
  
  <p>Tomcat hosted Spring Application Context:</p>
  
  <pre><code>&lt;!-- Rabbit MQ configuration Start --&gt;
      &lt;!-- Connection Factory --&gt;
      &lt;rabbit:connection-factory id="rabbitConnFactory" virtual-host="/" username="guest" password="guest" port="5672"/&gt;
  
      &lt;!-- Spring AMQP Template --&gt;
      &lt;rabbit:template id="rabbitTemplate" connection-factory="rabbitConnFactory" routing-key="ecl.down.queue" queue="ecl.down.queue" /&gt;
  
      &lt;!-- Spring AMQP Admin --&gt;
      &lt;rabbit:admin id="admin" connection-factory="rabbitConnFactory"/&gt;
  
      &lt;rabbit:queue id="ecl.down.queue" name="ecl.down.queue" /&gt;
  
      &lt;rabbit:direct-exchange name="ecl.down.exchange"&gt;
          &lt;rabbit:bindings&gt;
              &lt;rabbit:binding key="ecl.down.key" queue="ecl.down.queue"/&gt;
          &lt;/rabbit:bindings&gt;
      &lt;/rabbit:direct-exchange&gt;
  </code></pre>
  
  <p>In my Controller Class</p>
  
  <pre><code>@Autowired
  RmqMessageSender rmqMessageSender;
  
  //Inside a method
  rmqMessageSender.submitToECLDown(orderInSession.getOrderNo());
  </code></pre>
  
  <p>In My Message sender:</p>
  
  <pre><code>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());
          }
      }       
  }
  </code></pre>
  
  <p>Above exception Block gives below Exception</p>
  
  <hr>
  
  <blockquote>
    <p>org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.</p>
  </blockquote>
  
  <hr>
  
  <p>Error Log</p>
  
  <pre><code>  =ERROR REPORT==== 7-Nov-2014::18:04:37 ===
  closing AMQP connection &lt;0.489.0&gt; (10.1.XX.2XX:52298 -&gt; 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'}}
  </code></pre>
  
  <p>Pls find below the pom.xml entry</p>
  
  <pre><code>        &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.amqp&lt;/groupId&gt;
              &lt;artifactId&gt;spring-rabbit&lt;/artifactId&gt;
              &lt;version&gt;1.3.6.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.integration&lt;/groupId&gt;
              &lt;artifactId&gt;spring-integration-amqp&lt;/artifactId&gt;
              &lt;version&gt;4.0.4.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>Please let me know if you have any thoughts/suggestions</p>