title: Eureka+Cloud-Config with Wildfly and deployment order
body: <p>I need to integrate some SpringBoot services in a Wildfly environment. 
  There is a Eureka-Server+Cloud Config-Service runing as a WAR in a wildfly. I cannot see the dashboard, but I can see the self-registered service in the XML data in ..eureka/apps
  If I start a SpringBoot client for Eureka/Cloud Config in a standalone mode - it connects perfectly to this Wildfly/Eureka/CloudConfig service. The same, when I add this client as a WAR into the already running Wildfly/Eureka/CloudConfig system.</p>
  
  <p>But when I kill the server and restart it, the parallel deployment of the two WARs produce of course a lot of exception during startup. Thats ok, because the Eureka Server isn't up yet. But after it's - the client registeres itself correctly to the Eureka server (I see it in eureka/apps again). But the client sends exceptions all the time.</p>
  
  <pre><code>2018-06-22 12:40:10,345 WARN  [org.springframework.cloud.config.client.DiscoveryClientConfigServiceBootstrapConfiguration] (DiscoveryClient-CacheRefreshExecutor-0) Could not locate configserver via discovery: java.lang.IllegalStateException: No instances found of configserver (EUREKA-DISCOVERY-SERVICE)
          at org.springframework.cloud.config.client.ConfigServerInstanceProvider.getConfigServerInstance(ConfigServerInstanceProvider.java:25)
          at org.springframework.cloud.config.client.DiscoveryClientConfigServiceBootstrapConfiguration.refresh(DiscoveryClientConfigServiceBootstrapConfiguration.java:80)
          at org.springframework.cloud.config.client.DiscoveryClientConfigServiceBootstrapConfiguration.heartbeat(DiscoveryClientConfigServiceBootstrapConfiguration.java:72)
          at sun.reflect.GeneratedMethodAccessor122.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:261)
          at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:180)
          at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:142)
          at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
          at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
          at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
          at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:400)
          at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:406)
          at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:354)
          at org.springframework.cloud.netflix.eureka.CloudEurekaClient.onCacheRefreshed(CloudEurekaClient.java:112)
          at com.netflix.discovery.DiscoveryClient.fetchRegistry(DiscoveryClient.java:981)
          at com.netflix.discovery.DiscoveryClient.refreshRegistry(DiscoveryClient.java:1471)
          at com.netflix.discovery.DiscoveryClient$CacheRefreshThread.run(DiscoveryClient.java:1438)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
  </code></pre>
  
  <p>The exception comes every 30sec (refresh time).
  I don't understand, why this happens. The ...eureka/apps result shows the service</p>
  
  <pre><code>&lt;applications&gt;
    &lt;versions__delta&gt;1&lt;/versions__delta&gt;
    &lt;apps__hashcode&gt;UP_2_&lt;/apps__hashcode&gt;
    &lt;application&gt;
      &lt;name&gt;EUREKA-DISCOVERY-SERVICE&lt;/name&gt;
      &lt;instance&gt;
        &lt;instanceId&gt;192.168.207.94:eureka-discovery-service:8443&lt;/instanceId&gt;
        &lt;hostName&gt;localhost&lt;/hostName&gt;
        &lt;app&gt;EUREKA-DISCOVERY-SERVICE&lt;/app&gt;
        &lt;ipAddr&gt;192.168.207.94&lt;/ipAddr&gt;
        &lt;status&gt;UP&lt;/status&gt;
        &lt;overriddenstatus&gt;UNKNOWN&lt;/overriddenstatus&gt;
        &lt;port enabled="false"&gt;80&lt;/port&gt;
        &lt;securePort enabled="true"&gt;8443&lt;/securePort&gt;
        &lt;countryId&gt;1&lt;/countryId&gt;
        &lt;dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo"&gt;
          &lt;name&gt;MyOwn&lt;/name&gt;
        &lt;/dataCenterInfo&gt;
        &lt;leaseInfo&gt;
          &lt;renewalIntervalInSecs&gt;30&lt;/renewalIntervalInSecs&gt;
          &lt;durationInSecs&gt;90&lt;/durationInSecs&gt;
          &lt;registrationTimestamp&gt;1529662231729&lt;/registrationTimestamp&gt;
          &lt;lastRenewalTimestamp&gt;1529663993904&lt;/lastRenewalTimestamp&gt;
          &lt;evictionTimestamp&gt;0&lt;/evictionTimestamp&gt;
          &lt;serviceUpTimestamp&gt;1529662210687&lt;/serviceUpTimestamp&gt;
        &lt;/leaseInfo&gt;
        &lt;metadata&gt;
          &lt;management.port&gt;8443&lt;/management.port&gt;
          &lt;configPath&gt;/eureka-ds/config&lt;/configPath&gt;
        &lt;/metadata&gt;
        &lt;homePageUrl&gt;http://localhost:80/&lt;/homePageUrl&gt;
        &lt;statusPageUrl&gt;http://localhost:8443/actuator/info&lt;/statusPageUrl&gt;
        &lt;healthCheckUrl&gt;http://localhost:8443/actuator/health&lt;/healthCheckUrl&gt;
        &lt;secureHealthCheckUrl&gt;https://localhost:8443/actuator/health&lt;/secureHealthCheckUrl&gt;
        &lt;vipAddress&gt;eureka-discovery-service&lt;/vipAddress&gt;
        &lt;secureVipAddress&gt;eureka-discovery-service&lt;/secureVipAddress&gt;
        &lt;isCoordinatingDiscoveryServer&gt;true&lt;/isCoordinatingDiscoveryServer&gt;
        &lt;lastUpdatedTimestamp&gt;1529662231729&lt;/lastUpdatedTimestamp&gt;
        &lt;lastDirtyTimestamp&gt;1529662193289&lt;/lastDirtyTimestamp&gt;
        &lt;actionType&gt;ADDED&lt;/actionType&gt;
      &lt;/instance&gt;
    &lt;/application&gt;
    &lt;application&gt;
      &lt;name&gt;MARK2&lt;/name&gt;
      &lt;instance&gt;
        &lt;instanceId&gt;192.168.207.94:mark2:9998&lt;/instanceId&gt;
        &lt;hostName&gt;192.168.207.94&lt;/hostName&gt;
        &lt;app&gt;MARK2&lt;/app&gt;
        &lt;ipAddr&gt;192.168.207.94&lt;/ipAddr&gt;
        &lt;status&gt;UP&lt;/status&gt;
        &lt;overriddenstatus&gt;UNKNOWN&lt;/overriddenstatus&gt;
        &lt;port enabled="true"&gt;9998&lt;/port&gt;
        &lt;securePort enabled="false"&gt;443&lt;/securePort&gt;
        &lt;countryId&gt;1&lt;/countryId&gt;
        &lt;dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo"&gt;
          &lt;name&gt;MyOwn&lt;/name&gt;
        &lt;/dataCenterInfo&gt;
        &lt;leaseInfo&gt;
          &lt;renewalIntervalInSecs&gt;30&lt;/renewalIntervalInSecs&gt;
          &lt;durationInSecs&gt;90&lt;/durationInSecs&gt;
          &lt;registrationTimestamp&gt;1529662210686&lt;/registrationTimestamp&gt;
          &lt;lastRenewalTimestamp&gt;1529663979339&lt;/lastRenewalTimestamp&gt;
          &lt;evictionTimestamp&gt;0&lt;/evictionTimestamp&gt;
          &lt;serviceUpTimestamp&gt;1529662210687&lt;/serviceUpTimestamp&gt;
        &lt;/leaseInfo&gt;
        &lt;metadata&gt;
          &lt;management.port&gt;9998&lt;/management.port&gt;
          &lt;configPath&gt;/eureka-ds/config&lt;/configPath&gt;
          &lt;user&gt;user&lt;/user&gt;
          &lt;password&gt;software1&lt;/password&gt;
        &lt;/metadata&gt;
        &lt;homePageUrl&gt;http://192.168.207.94:9998/&lt;/homePageUrl&gt;
        &lt;statusPageUrl&gt;http://192.168.207.94:9998/actuator/info&lt;/statusPageUrl&gt;
        &lt;healthCheckUrl&gt;http://192.168.207.94:9998/actuator/health&lt;/healthCheckUrl&gt;
        &lt;vipAddress&gt;mark2&lt;/vipAddress&gt;
        &lt;secureVipAddress&gt;mark2&lt;/secureVipAddress&gt;
        &lt;isCoordinatingDiscoveryServer&gt;false&lt;/isCoordinatingDiscoveryServer&gt;
        &lt;lastUpdatedTimestamp&gt;1529662210687&lt;/lastUpdatedTimestamp&gt;
        &lt;lastDirtyTimestamp&gt;1529662208806&lt;/lastDirtyTimestamp&gt;
        &lt;actionType&gt;ADDED&lt;/actionType&gt;
      &lt;/instance&gt;
    &lt;/application&gt;
  &lt;/applications&gt;
  </code></pre>