These are chat archives for spring-cloud/spring-cloud

16th
Jun 2018
Jose Armesto
@fiunchinho
Jun 16 2018 09:10
there was no gateway, just regular instances trying to talk to each other
most of them on aws
Marcos Barbero
@marcosbarbero
Jun 16 2018 09:18
Sure, where’s the request entry point?
Jose Armesto
@fiunchinho
Jun 16 2018 09:30
the requests come from client browser to service A, that wants to talk to service B: that's the one having instances both in and out AWS
makes sense?
Marcos Barbero
@marcosbarbero
Jun 16 2018 09:31
It does, and now, where’s the service A hosted?
Jose Armesto
@fiunchinho
Jun 16 2018 09:31
oh, AWS, sorry
Marcos Barbero
@marcosbarbero
Jun 16 2018 09:36
And it goes from service A in AWS to service B on your local machine?
Jose Armesto
@fiunchinho
Jun 16 2018 13:40
yes
all requests end up in service B on my local machine, even though there are other service B instances registered on eureka
Marcos Barbero
@marcosbarbero
Jun 16 2018 13:41
I’m more interested where the service A is hosted
Jose Armesto
@fiunchinho
Jun 16 2018 13:42
AWS
Marcos Barbero
@marcosbarbero
Jun 16 2018 13:46
How does it finds your machine from AWS?
Jose Armesto
@fiunchinho
Jun 16 2018 13:47
the app registers in eureka using its private IP (the ip on my machine), and we have AWS Direct Connect enabled, so communication between the instances in the VPC and our LAN is allowed
Marcos Barbero
@marcosbarbero
Jun 16 2018 13:47
Now it makes more sense to me :smile:
Jose Armesto
@fiunchinho
Jun 16 2018 13:47
nice!
Gilles Robert
@ask4gilles
Jun 16 2018 20:01

Hi,
I'm trying to use a config server with Vault and Consul, with service discovery (SB 1.5, Edgware.SR3)
The bootstrap.yml of my config server is as follow:

# SERVER CONFIGURATION
server:
  port: 8094

# APP CONFIGURATION
spring:
  application:
    name: configserver

# SPRING PROFILES
  profiles:
    active: vault
  cloud:
    consul:
      discovery:
        failFast: false
        healthCheckPath: /health
        healthCheckInterval: 15s
        service-name: configserver
        preferIpAddress: true
        enabled: true
    vault:
      discovery:
        service-id: vault
        enabled: true
      scheme: http # has to be https for production
      authentication: token
      token: XXXXXXXXXX

# ACTUATOR ENDPOINTS
endpoints:
  enabled: true
  sensitive: false

Apparently, the ConsulDiscoveryClient is not picked up before Vault Configuration?

2018-06-16 21:52:15.476  WARN 112515 --- [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'vaultBootstrapConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.vault.config.VaultBootstrapConfiguration$$EnhancerBySpringCGLIB$$efcb9c65]: Constructor threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'discoveryClientVaultBootstrapConfiguration': Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.cloud.client.discovery.DiscoveryClient' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2018-06-16 21:52:15.487  INFO 112515 --- [           main] utoConfigurationReportLoggingInitializer : 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-06-16 21:52:15.525 ERROR 112515 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************
Description:

Parameter 1 of constructor in org.springframework.cloud.vault.config.DiscoveryClientVaultBootstrapConfiguration required a bean of type 'org.springframework.cloud.client.discovery.DiscoveryClient' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.cloud.client.discovery.DiscoveryClient' in your configuration.
Marcos Barbero
@marcosbarbero
Jun 16 2018 20:40
can you share you dependencies?
Gilles Robert
@ask4gilles
Jun 16 2018 20:42
@marcosbarbero deps.png
Marcos Barbero
@marcosbarbero
Jun 16 2018 20:46
Do you have @EnableDiscoveryClient somewhere in the code?
Gilles Robert
@ask4gilles
Jun 16 2018 20:48
@SpringBootApplication
@EnableConfigServer
@EnableDiscoveryClient
public class ConfigServerApplication { // NOPMD

  public static void main(String[] args) {
    SpringApplication.run(ConfigServerApplication.class, args);
  }
}
my config server is also registered in Consul
Gilles Robert
@ask4gilles
Jun 16 2018 20:54
Isn't it because of this @Order ?
@Order(Ordered.LOWEST_PRECEDENCE - 2)
@EnableDiscoveryClient
@Import(UtilAutoConfiguration.class)
public class DiscoveryClientVaultBootstrapConfiguration {
Marcos Barbero
@marcosbarbero
Jun 16 2018 20:58
shouldn't be
unless you have some homegrown autoconfiguration added to the project
Gilles Robert
@ask4gilles
Jun 16 2018 20:58
nope
I only have this main class in the application
Marcos Barbero
@marcosbarbero
Jun 16 2018 21:02
can you run in debug to see if you can get more info in the logs?
Gilles Robert
@ask4gilles
Jun 16 2018 21:13
exception.png
nothing more...
main@1" prio=5 tid=0x1 nid=NA runnable
  java.lang.Thread.State: RUNNABLE
      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
      at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1193)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1095)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      - locked <0x10a6> (a java.util.concurrent.ConcurrentHashMap)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:372)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
      at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectProvider.getIfAvailable(DefaultListableBeanFactory.java:1662)
      at org.springframework.cloud.vault.config.VaultBootstrapConfiguration.<init>(VaultBootstrapConfiguration.java:81)
      at org.springframework.cloud.vault.config.VaultBootstrapConfiguration$$EnhancerBySpringCGLIB$$e167d12b.<init>(<generated>:-1)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(NativeConstructorAccessorImpl.java:-1)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122)
      at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:271)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1193)
      at org.springfr
Marcos Barbero
@marcosbarbero
Jun 16 2018 21:17
can you share your project in a public repo?
Gilles Robert
@ask4gilles
Jun 16 2018 21:17


=========================
AUTO-CONFIGURATION REPORT
=========================


Positive matches:
-----------------

   AutoServiceRegistrationConfiguration matched:
      - @ConditionalOnProperty (spring.cloud.service-registry.auto-registration.enabled) matched (OnPropertyCondition)

   ConfigurationPropertiesRebinderAutoConfiguration matched:
      - @ConditionalOnBean (types: org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor; SearchStrategy: all) found bean 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor' (OnBeanCondition)

   ConfigurationPropertiesRebinderAutoConfiguration#configurationPropertiesBeans matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.context.properties.ConfigurationPropertiesBeans; SearchStrategy: current) did not find any beans (OnBeanCondition)

   ConfigurationPropertiesRebinderAutoConfiguration#configurationPropertiesRebinder matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder; SearchStrategy: current) did not find any beans (OnBeanCondition)

   DefaultTextEncryptorConfiguration matched:
      - @ConditionalOnMissingBean (types: org.springframework.security.crypto.encrypt.TextEncryptor; SearchStrategy: all) did not find any beans (OnBeanCondition)

   DiscoveryClientVaultBootstrapConfiguration matched:
      - @ConditionalOnProperty (spring.cloud.vault.discovery.enabled) matched (OnPropertyCondition)

   DiscoveryClientVaultBootstrapConfiguration#vaultEndpointProvider matched:
      - @ConditionalOnMissingBean (types: org.springframework.vault.client.VaultEndpointProvider; SearchStrategy: all) did not find any beans (OnBeanCondition)

   EncryptionAutoConfiguration.EncryptorConfiguration matched:
      - @ConditionalOnProperty (spring.cloud.config.server.encrypt.enabled) matched (OnPropertyCondition)

   EncryptionAutoConfiguration.EncryptorConfiguration#environmentEncryptor matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.config.server.encryption.EnvironmentEncryptor; SearchStrategy: all) did not find any beans (OnBeanCondition)

   EncryptionBootstrapConfiguration matched:
      - @ConditionalOnClass found required class 'org.springframework.security.crypto.encrypt.TextEncryptor'; @ConditionalOnMissingClass did not find unwanted class (OnClassCondition)

   PropertyPlaceholderAutoConfiguration#propertySourcesPlaceholderConfigurer matched:
      - @ConditionalOnMissingBean (types: org.springframework.context.support.PropertySourcesPlaceholderConfigurer; SearchStrategy: current) did not find any beans (OnBeanCondition)

   UtilAutoConfiguration matched:
      - @ConditionalOnProperty (spring.cloud.util.enabled) matched (OnPropertyCondition)

   UtilAutoConfiguration#inetUtils matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.commons.util.InetUtils; SearchStrategy: all) did not find any beans (OnBeanCondition)

   VaultBootstrapConfiguration matched:
      - @ConditionalOnProperty (spring.cloud.vault.enabled) matched (OnPropertyCondition)

   VaultBootstrapConfiguration#clientAuthentication matched:
      - @ConditionalOnMissingBean (types: org.springframework.vault.authentication.ClientAuthentication; SearchStrategy: all) did not find any beans (OnBeanCondition)

   VaultBootstrapConfiguration#clientHttpRequestFactoryWrapper matched:
      - @ConditionalOnMissingBean (types: org.springframework.vault.config.AbstractVaultConfiguration$ClientFactoryWrapper; SearchStrategy: all) did not find any beans (OnBeanCondition)

   VaultBootstrapConfiguration#sessionManager matched:
      - @ConditionalOnMissingBean (types: org.springframework.vault.authentication.SessionManager; SearchStrategy: all) did not find any beans (OnBeanCondition)

   VaultBootstrapConfiguration#vaultTaskScheduler matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.vault.config.VaultBootstrapConfiguration$TaskSchedulerWrapper; SearchStrategy: all) did not find
yes
Gilles Robert
@ask4gilles
Jun 16 2018 21:34
@marcosbarbero here you are : https://github.com/ask4gilles/springcloud-debug