Closed scottfrederick closed 5 years ago
Fixed via f89724c
i tried moving to 2.1.3.RELEASE to resolve the original issue but still can't get this working. The error I now get is
java.lang.IllegalStateException: No HttpServletRequest available
at org.springframework.cloud.config.server.environment.HttpRequestConfigTokenProvider.getToken(HttpRequestConfigTokenProvider.java:41)
at org.springframework.cloud.config.server.environment.VaultEnvironmentRepository.getToken(VaultEnvironmentRepository.java:218)
at org.springframework.cloud.config.server.environment.VaultEnvironmentRepository.read(VaultEnvironmentRepository.java:209)
at org.springframework.cloud.config.server.environment.VaultEnvironmentRepository.findOne(VaultEnvironmentRepository.java:147)
at org.springframework.cloud.config.server.environment.CompositeEnvironmentRepository.findOne(CompositeEnvironmentRepository.java:61)
at org.springframework.cloud.config.server.environment.EnvironmentRepositoryPropertySourceLocator.locate(EnvironmentRepositoryPropertySourceLocator.java:55)
at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:97)
at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:649)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:373)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
I am running in embedded mode (inside jHipster Registry). Here are other relevant piece of my code and configuration
Spring Boot App
@EnableEurekaServer
@EnableConfigServer
@SpringBootApplication
@EnableConfigurationProperties({ApplicationProperties.class, ConfigServerConfig.class})
@EnableDiscoveryClient
@EnableZuulProxy
public class JHipsterRegistryApp {
...
}
bootstrap.xml
spring
cloud:
config:
server:
bootstrap: true
composite:
- type: git
uri: https://...
- type: native
search-locations: file:///project/code/sample-projects/config
- type: vault
host: 192.168.99.100
port: 8200
uri: http://192.168.99.100:8200
scheme: http
kv-version: 2
Starting the application using
java -jar target/jhipster-registry-5.0.2.jar --spring.profiles.active=composite
What am i missing?
Please open a separate issue with a minimal project to reproduce the error
When embedding config server in a Spring Boot application as described in the docs, and configuring a
vault
profile, the app will fail with an exception at startup:This is apparently due to the fact that the
VaultEnvironmentRepository
requires an activeHttpServletRequest
so that it can extract theX-Config-State
andX-Config-Token
headers from the HTTP request sent to config server, and there is no HTTP request active when the app bootstraps configuration in the embedded mode.