title: spring eureka security Batch update failure with HTTP status code 401
body: <p>I study spring cloud eureka , cloud and they works finely . But after adding security in eureka service , it met some errors .</p>
  
  <p>All the code and errors details is in <a href="https://github.com/keryhu/eureka-security" rel="noreferrer">https://github.com/keryhu/eureka-security</a></p>
  
  <p>The eureka service application.yml</p>
  
  <pre><code>security:
    user:
      name: user
      password: password
  
  eureka: 
    client:
      registerWithEureka: false
      fetchRegistry: false
    server:
      wait-time-in-ms-when-sync-empty: 0 
  </code></pre>
  
  <p>And The config-service application.java</p>
  
  <pre><code>@SpringBootApplication
  @EnableConfigServer
  @EnableDiscoveryClient
  </code></pre>
  
  <p>config-service application.yml</p>
  
  <pre><code>eureka:
    client:
      registry-fetch-interval-seconds: 5
      serviceUrl:
         defaultZone: http://user:password@${domain.name:localhost}:8761/eureka/
  
  spring:  
    cloud:
       config:
         server:
           git:
             uri: https://github.com/spring-cloud-samples/config-repo
             basedir: target/config 
  </code></pre>
  
  <blockquote>
    <p>There is errors exported after starting the config-service:</p>
  </blockquote>
  
  <pre><code>2016-04-10 11:22:39.402 ERROR 80526 --- [get_localhost-3] c.n.e.cluster.ReplicationTaskProcessor   : Batch update failure with HTTP status code 401; discarding 1 replication tasks
  2016-04-10 11:22:39.402  WARN 80526 --- [get_localhost-3] c.n.eureka.util.batcher.TaskExecutors    : Discarding 1 tasks of TaskBatchingWorker-target_localhost-3 due to permanent error
  2016-04-10 11:23:09.411 ERROR 80526 --- [get_localhost-3] c.n.e.cluster.ReplicationTaskProcessor   : Batch update failure with HTTP status code 401; discarding 1 replication tasks
  2016-04-10 11:23:09.412  WARN 80526 --- [get_localhost-3] c.n.eureka.util.batcher.TaskExecutors    : Discarding 1 tasks of TaskBatchingWorker-target_localhost-3 due to permanent error
  2016-04-10 11:23:39.429 ERROR 80526 --- [get_localhost-3] c.n.e.cluster.ReplicationTaskProcessor   : Batch update failure with HTTP status code 401; discarding 1 replication tasks
  2016-04-10 11:23:39.430  WARN 80526 --- [get_localhost-3] c.n.eureka.util.batcher.TaskExecutors    : Discarding 1 tasks of TaskBatchingWorker-target_localhost-3 due to permanent error
  </code></pre>