title: Memcached authentication failure in Java app
body: <p>I'm busy following Heroku's Memcached tutorial for Java: <a href="https://devcenter.heroku.com/articles/memcache#using-spymemcached-with-spring" rel="nofollow">https://devcenter.heroku.com/articles/memcache#using-spymemcached-with-spring</a></p>
  
  <p>I have installed Memcached via homebrew, got it up and running, added the Spymemcached dependency and added the XML config to my application context.</p>
  
  <p>The problem is I haven't got the faintest clue as to what the MEMCACHE_USERNAME and MEMCACHE_PASSWORD environment variables needs to be as I get the following authentication failures when my application context boots up locally:</p>
  
  <pre><code>2013-04-21 18:22:52.108 INFO net.spy.memcached.MemcachedConnection:  Added {QA sa=localhost/127.0.0.1:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue
  2013-04-21 18:22:52.127 INFO net.spy.memcached.MemcachedConnection:  Connection state changed for sun.nio.ch.SelectionKeyImpl@228ef305
  2013-04-21 18:22:52.283 WARN net.spy.memcached.auth.AuthThread:  Authentication failed to localhost/127.0.0.1:11211
  2013-04-21 18:22:52.398 WARN net.spy.memcached.auth.AuthThread:  Authentication failed to localhost/127.0.0.1:11211
  2013-04-21 18:22:52.520 WARN net.spy.memcached.auth.AuthThread:  Authentication failed to localhost/127.0.0.1:11211 ...
  </code></pre>
  
  <p>The config where the username and password is provided:</p>
  
  <pre><code>&lt;bean id="plainCallbackHandler" class="net.spy.memcached.auth.PlainCallbackHandler"&gt;
     &lt;constructor-arg index="0" value="${MEMCACHE_USERNAME}"/&gt;
     &lt;constructor-arg index="1" value="${MEMCACHE_PASSWORD}"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>I must be missing something fairly obvious... Any pointers?</p>