Closed narramadan closed 3 years ago
Can you try with boot 2.4.2 and Spring Cloud 2020.0.1?
Can you try with boot 2.4.2 and Spring Cloud 2020.0.1?
Sure.. will give it a try and get back..
@spencergibb - I tried with Spring Boot 2.4.2 and Spring Cloud 2020.0.1 and still see the same Binder has not been registered
exception with below stacktrace.
Pushed updated code to repo with changes to pom.xml - https://github.com/2much2learn/article_2021_jan_spring-cloud-config-configfirst_discoveryfirst/tree/master/spring-multi-module-cloud-config-consul-discovery
2021-02-23 12:17:55.272 INFO 17736 --- [nio-8082-exec-3] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-config/service-b,dev/'}, BootstrapPropertySource {name='bootstrapProperties-config/service-b/'}, BootstrapPropertySource {name='bootstrapProperties-config/application,dev/'}, BootstrapPropertySource {name='bootstrapProperties-config/application/'}]
2021-02-23 12:17:55.288 INFO 17736 --- [nio-8082-exec-3] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://192.168.0.147:8800/
2021-02-23 12:17:56.178 INFO 17736 --- [nio-8082-exec-3] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=common, service-b, profiles=[dev], label=null, version=02cf2b7c56248633a22186b4f81c93daac517aa2, state=null
2021-02-23 12:17:56.179 INFO 17736 --- [nio-8082-exec-3] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-configClient'}, BootstrapPropertySource {name='bootstrapProperties-https://github.com/2much2learn/article_2021_jan_spring-cloud-config-configfirst_discoveryfirst/Config resource 'file [C:\Users\narra\AppData\Local\Temp\config-repo-7132655559741745242\git-config-store\service-b.yaml' via location 'git-config-store/' (document spring-cloud/spring-cloud-config#1)'}, BootstrapPropertySource {name='bootstrapProperties-https://github.com/2much2learn/article_2021_jan_spring-cloud-config-configfirst_discoveryfirst/Config resource 'file [C:\Users\narra\AppData\Local\Temp\config-repo-7132655559741745242\git-config-store\service-b.yaml' via location 'git-config-store/' (document #0)'}, BootstrapPropertySource {name='bootstrapProperties-https://github.com/2much2learn/article_2021_jan_spring-cloud-config-configfirst_discoveryfirst/file:C:\Users\narra\AppData\Local\Temp\config-repo-7132655559741745242\git-config-store\common.yaml'}]
2021-02-23 12:17:56.231 ERROR 17736 --- [nio-8082-exec-3] o.s.boot.SpringApplication : Application run failed
java.lang.IllegalStateException: org.springframework.boot.context.properties.bind.Binder has not been registered
at org.springframework.boot.DefaultBootstrapContext.lambda$get$1(DefaultBootstrapContext.java:88) ~[spring-boot-2.4.2.jar!/:2.4.2]
at org.springframework.boot.DefaultBootstrapContext.getOrElseThrow(DefaultBootstrapContext.java:109) ~[spring-boot-2.4.2.jar!/:2.4.2]
at org.springframework.boot.DefaultBootstrapContext.get(DefaultBootstrapContext.java:88) ~[spring-boot-2.4.2.jar!/:2.4.2]
at org.springframework.cloud.consul.discovery.configclient.ConsulConfigServerBootstrapper.lambda$intitialize$3(ConsulConfigServerBootstrapper.java:54) ~[spring-cloud-consul-discovery-3.0.1.jar!/:3.0.1]
at org.springframework.boot.DefaultBootstrapContext.getInstance(DefaultBootstrapContext.java:119) ~[spring-boot-2.4.2.jar!/:2.4.2]
at org.springframework.boot.DefaultBootstrapContext.getOrElseThrow(DefaultBootstrapContext.java:111) ~[spring-boot-2.4.2.jar!/:2.4.2]
at org.springframework.boot.DefaultBootstrapContext.get(DefaultBootstrapContext.java:88) ~[spring-boot-2.4.2.jar!/:2.4.2]
at org.springframework.cloud.consul.discovery.configclient.ConsulConfigServerBootstrapper.lambda$intitialize$4(ConsulConfigServerBootstrapper.java:67) ~[spring-cloud-consul-discovery-3.0.1.jar!/:3.0.1]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-5.3.3.jar!/:5.3.3]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-5.3.3.jar!/:5.3.3]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-5.3.3.jar!/:5.3.3]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131) ~[spring-context-5.3.3.jar!/:5.3.3]
at org.springframework.boot.DefaultBootstrapContext.close(DefaultBootstrapContext.java:133) ~[spring-boot-2.4.2.jar!/:2.4.2]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:392) ~[spring-boot-2.4.2.jar!/:2.4.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) ~[spring-boot-2.4.2.jar!/:2.4.2
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:144) ~[spring-boot-2.4.2.jar!/:2.4.2]
at org.springframework.cloud.context.refresh.LegacyContextRefresher.addConfigFilesToEnvironment(LegacyContextRefresher.java:60) ~[spring-cloud-context-3.0.1.jar!/:3.0.1]
at org.springframework.cloud.context.refresh.LegacyContextRefresher.updateEnvironment(LegacyContextRefresher.java:46) ~[spring-cloud-context-3.0.1.jar!/:3.0.1]
at org.springframework.cloud.context.refresh.ContextRefresher.refreshEnvironment(ContextRefresher.java:90) ~[spring-cloud-context-3.0.1.jar!/:3.0.1]
at org.springframework.cloud.context.refresh.ContextRefresher.refresh(ContextRefresher.java:83) ~[spring-cloud-context-3.0.1.jar!/:3.0.1]
at org.springframework.cloud.endpoint.RefreshEndpoint.refresh(RefreshEndpoint.java:41) ~[spring-cloud-context-3.0.1.jar!/:3.0.1]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) ~[spring-core-5.3.3.jar!/:5.3.3]
at org.springframework.boot.actuate.endpoint.invoke.reflect.ReflectiveOperationInvoker.invoke(ReflectiveOperationInvoker.java:77) ~[spring-boot-actuator-2.4.2.jar!/:2.4.2]
at org.springframework.boot.actuate.endpoint.annotation.AbstractDiscoveredOperation.invoke(AbstractDiscoveredOperation.java:60) ~[spring-boot-actuator-2.4.2.jar!/:2.4.2]
at org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$ServletWebOperationAdapter.handle(AbstractWebMvcEndpointHandlerMapping.java:290) ~[spring-boot-actuator-2.4.2.jar!/:2.4.2]
at org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(AbstractWebMvcEndpointHandlerMapping.java:373) ~[spring-boot-actuator-2.4.2.jar!/:2.4.2]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197) ~[spring-web-5.3.3.jar!/:5.3.3]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141) ~[spring-web-5.3.3.jar!/:5.3.3]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:652) ~[tomcat-embed-core-9.0.41.jar!/:4.0.FR]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.41.jar!/:4.0.FR]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.41.jar!/:9.0.41]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.3.jar!/:5.3.3]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.3.jar!/:5.3.3]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.3.jar!/:5.3.3]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.3.jar!/:5.3.3]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.2.jar!/:2.4.2]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.3.jar!/:5.3.3]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.3.jar!/:5.3.3]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.3.jar!/:5.3.3]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
I'm getting the same problem with spring cloud 2020.0.x and spring boot 2.4.x refresh seems to work OK if I down grade spring boot and use spring cloud 2020.0.x with spring boot 2.3.x
@pcoates33 I had exactly the same issue.
The way I fixed that error is by removing the @Configuration annotation that I put with the @ConfigurationProperties(prefix = "") annotation.
I after use the annotation @EnableConfigurationProperties to enable the property file to be used in my other class.
make sense?
Indeed @Configuration
should not be on a class with @ConfigurationProperties
.
@narramadan can you supply a minimal sample (single project, minimal, if no, consul customization needed)? Your existing project is too large and complex to test quickly.
@royremi many thanks for the suggestion, but I still see the problem when I use @EnableConfigurationProperties
I have removed the @ConfigurationProperties annotation so my project no longer has any and I still get the error when I use the actuator/refresh endpoint
@pcoates33 Do you use swagger? I just had the same issue with the swagger dependency 2.9.x. I upgraded my swagger to 3.0.0 and the problem when away.
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
modified to
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0</version>
</dependency>
@royremi I did, but I've already removed it.
Sample project to recreate problem : https://github.com/pcoates33/simple-service Sample config server : https://github.com/pcoates33/configserver
Need consul on port localhost:8500
Need configserver project running with a simple-service.yml file.
With consul and configserver started, start the simple-service project.
I've tried debugging and can see the exception comes out of ConsulConfigServerBootstrapper
This class is used when I include the 'org.springframework.cloud:spring-cloud-starter-consul-discovery' dependency.
As far as I can work out when the actuator/refresh is called, the SpringApplication::run method is called as part of the refresh. A new bootstrapContext is created, then while processing it...
the run method is called again (from BootstrapApplicationListener)
so a second bootstrapContext is created,
this second one gets processed, and a Binder is added (by ConfigDataEnvironmentPostProcessor),
the bootstrapContext is closed which invokes the close listener in ConsulConfigServerBootstrapper
the close listener checks for the ConsulDiscoveryClient (because there's a Binder in the context this works)
processing of this second bootstrapContext completes
It then goes back to continue processing the first one
nothing adds a Binder to this bootstrapContext
So, when the context is closed and the ConsulConfigServerBootstrapper does it's thing,
the lack of a Binder creates the exception
If I wrap the close listener code in ConsulConfigServerBootstrapper with a try catch and ignore the exception, the refresh actually works OK. However, I have no idea if this is a sensible solution.
The initial application start call to SpringApplication::run has a different set of listeners to the refresh call, so the behaviour is slightly different. At startup, It still generates 2 bootstrapContexts, but both get a Binder added and no exception on startup.
The problem occurs when you use actuator/refresh and have both of the following dependencies
The bootstrap starter means that refresh will be performed by org.springframework.cloud.context.refresh.LegacyContextRefresher this runs a SpringApplication with a reduced set of listeners
// Just the listeners that affect the environment (e.g. excluding logging
// listener because it has side effects)
builder.application().setListeners(
Arrays.asList(new BootstrapApplicationListener(), new BootstrapConfigFileApplicationListener()));
capture = builder.run();
The consul discovery adds org.springframework.cloud.consul.discovery.configclient.ConsulConfigServerBootstrapper to the SpringApplication run bootstrap process. This adds the closeListener for the bootstrapContext close event which throws the exception when no Binder is present.
On application start, the Binder is added by org.springframework.boot.context.config.ConfigDataEnvironment, which is called from ConfigDataEnvironmentPostProcessor, which is called from EnvironmentPostProcessorApplicationListener.
However, on a refresh, the LegacyContextRefresher does not add the EnvironmentPostProcessorApplicationListener, which means no Binder is registered. So, the "Binder has not been registered" exception occurs when the close listener in ConsulConfigServerBootstrapper is called.
Adding the EnvironmentPostProcessorApplicationListener to LegacyContextRefresher makes the refresh work OK.
// Just the listeners that affect the environment (e.g. excluding logging
// listener because it has side effects)
builder.application().setListeners(
Arrays.asList(new BootstrapApplicationListener(), new BootstrapConfigFileApplicationListener(),
new EnvironmentPostProcessorApplicationListener()));
capture = builder.run();
Thanks @pcoates33. This works for us.
@spencergibb thanks for fixing this.
Hi @spencergibb,
We also meet this issue, we use spring-boot:2.4.5, spring-cloud:2020.0.2 with zookeeper-discovery. We start to migrate to spring-boot 2.4.x just a week ago, there maybe some profile mismatch on new version, I'm not sure whether our profile has errors or bugs exist with zookeeper-discovery.
This error happens when we use /actuator/refresh to refresh context.
ConfigServer
----------application.yml----------
spring:
config:
activate:
on-profile: local
cloud:
zookeeper:
connect-string: localhost:2181
discovery:
root: /transient/transient-services
enabled: true
register: false
config:
name: configserver
server:
git:
uri: git@xxxxxxxxxx/config-template.git
refreshRate: 180
force-pull: true
searchPaths: '{application}'
basedir: /tmp/config-server-repo
ignoreLocalSshSettings: true
default-label: main
privateKey: |
-----BEGIN RSA PRIVATE KEY-----
xxxxxxxxx
-----END RSA PRIVATE KEY-----
ConfigClient
----------bootstrap.yml----------
spring:
application:
name: transientserver
profiles:
active: local
---
spring:
config:
activate:
on-profile: local
cloud:
config:
uri: http://127.0.0.1:8888
fail-fast: true
name: config-template
label: main
----------application.yml----------
spring:
config:
activate:
on-profile: local
cloud:
zookeeper:
connect-string: localhost:2181
discovery:
prefer-ip-address: true
root: /transient/transient-services
enabled: true
register: true
Deubg Error Message:
2021-04-23 21:57:57.089 DEBUG 49023 --- [nio-8081-exec-1] o.s.c.e.PropertySourcesPropertyResolver : Found key 'spring.cloud.bootstrap.enabled' in PropertySource 'configurationProperties' with value of type String
2021-04-23 21:57:57.090 DEBUG 49023 --- [nio-8081-exec-1] o.a.c.loader.WebappClassLoaderBase : findClass(java.lang.ObjectCustomizer)
2021-04-23 21:57:57.090 DEBUG 49023 --- [nio-8081-exec-1] o.a.c.loader.WebappClassLoaderBase : --> Returning ClassNotFoundException
2021-04-23 21:57:57.091 DEBUG 49023 --- [nio-8081-exec-1] o.a.c.loader.WebappClassLoaderBase : findClass(org.springframework.cloud.config.client.ConfigClientPropertiesCustomizer)
2021-04-23 21:57:57.091 DEBUG 49023 --- [nio-8081-exec-1] o.a.c.loader.WebappClassLoaderBase : --> Returning ClassNotFoundException
2021-04-23 21:57:57.093 DEBUG 49023 --- [nio-8081-exec-1] o.s.c.e.PropertySourcesPropertyResolver : Found key 'spring.application.name' in PropertySource 'configurationProperties' with value of type String
2021-04-23 21:57:57.093 DEBUG 49023 --- [nio-8081-exec-1] o.s.c.e.PropertySourcesPropertyResolver : Found key 'spring.cloud.config.name' in PropertySource 'configurationProperties' with value of type String
2021-04-23 21:57:57.093 DEBUG 49023 --- [nio-8081-exec-1] o.s.c.e.PropertySourcesPropertyResolver : Found key 'spring.cloud.config.label' in PropertySource 'configurationProperties' with value of type String
2021-04-23 21:57:57.095 INFO 49023 --- [nio-8081-exec-1] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://127.0.0.1:8888
2021-04-23 21:57:57.095 DEBUG 49023 --- [nio-8081-exec-1] o.s.web.client.RestTemplate : HTTP GET http://127.0.0.1:8888/config-template/local/main
2021-04-23 21:57:57.097 DEBUG 49023 --- [nio-8081-exec-1] o.s.web.client.RestTemplate : Accept=[application/json, application/*+json]
2021-04-23 21:57:57.098 DEBUG 49023 --- [nio-8081-exec-1] s.n.www.protocol.http.HttpURLConnection : sun.net.www.MessageHeader@7d6497bf5 pairs: {GET /config-template/local/main HTTP/1.1: null}{Accept: application/vnd.spring-cloud.config-server.v2+json}{User-Agent: Java/1.8.0_271}{Host: 127.0.0.1:8888}{Connection: keep-alive}
2021-04-23 21:58:00.160 DEBUG 49023 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Got ping response for session id: 0x100000b09a1007b after 0ms.
2021-04-23 21:58:00.534 DEBUG 49023 --- [nio-8081-exec-1] s.n.www.protocol.http.HttpURLConnection : sun.net.www.MessageHeader@1e591d416 pairs: {null: HTTP/1.1 200}{Content-Type: application/vnd.spring-cloud.config-server.v2+json}{Transfer-Encoding: chunked}{Date: Fri, 23 Apr 2021 13:58:00 GMT}{Keep-Alive: timeout=60}{Connection: keep-alive}
2021-04-23 21:58:00.534 DEBUG 49023 --- [nio-8081-exec-1] o.s.web.client.RestTemplate : Response 200 OK
2021-04-23 21:58:00.534 DEBUG 49023 --- [nio-8081-exec-1] o.s.web.client.RestTemplate : Reading to [org.springframework.cloud.config.environment.Environment]
2021-04-23 21:58:00.535 INFO 49023 --- [nio-8081-exec-1] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=config-template, profiles=[local], label=main, version=12cc55f134f55bdc0323202c7d008b9db196c774, state=null
2021-04-23 21:58:00.535 DEBUG 49023 --- [nio-8081-exec-1] c.c.c.ConfigServicePropertySourceLocator : Environment config-template has 0 property sources with 0 properties.
2021-04-23 21:58:00.535 INFO 49023 --- [nio-8081-exec-1] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource@737988146 {name='bootstrapProperties-configClient', properties={config.client.version=12cc55f134f55bdc0323202c7d008b9db196c774}}]
2021-04-23 21:58:00.537 DEBUG 49023 --- [nio-8081-exec-1] o.s.c.e.PropertySourcesPropertyResolver : Found key 'spring.cloud.bootstrap.enabled' in PropertySource 'configurationProperties' with value of type String
2021-04-23 21:58:00.537 DEBUG 49023 --- [nio-8081-exec-1] o.s.c.e.PropertySourcesPropertyResolver : Found key 'spring.cloud.bootstrap.enabled' in PropertySource 'configurationProperties' with value of type String
2021-04-23 21:58:00.549 DEBUG 49023 --- [nio-8081-exec-1] o.a.c.loader.WebappClassLoaderBase : findClass(org.springframework.cloud.config.client.ConfigServerConfigDataMissingEnvironmentPostProcessor.ImportExceptionFailureAnalyzer)
2021-04-23 21:58:00.550 DEBUG 49023 --- [nio-8081-exec-1] o.a.c.loader.WebappClassLoaderBase : --> Returning ClassNotFoundException
2021-04-23 21:58:00.552 ERROR 49023 --- [nio-8081-exec-1] o.s.boot.SpringApplication : Application run failed
java.lang.IllegalStateException: org.springframework.boot.context.properties.bind.Binder has not been registered
at org.springframework.boot.DefaultBootstrapContext.lambda$get$1(DefaultBootstrapContext.java:88) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.boot.DefaultBootstrapContext.getOrElseThrow(DefaultBootstrapContext.java:109) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.boot.DefaultBootstrapContext.get(DefaultBootstrapContext.java:88) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.cloud.zookeeper.CuratorFactory.lambda$registerCurator$1(CuratorFactory.java:89) ~[spring-cloud-zookeeper-core-3.0.2.jar:3.0.2]
at org.springframework.boot.DefaultBootstrapContext.getInstance(DefaultBootstrapContext.java:119) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.boot.DefaultBootstrapContext.getOrElseThrow(DefaultBootstrapContext.java:111) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.boot.DefaultBootstrapContext.get(DefaultBootstrapContext.java:88) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.cloud.zookeeper.CuratorFactory.lambda$registerCurator$3(CuratorFactory.java:94) ~[spring-cloud-zookeeper-core-3.0.2.jar:3.0.2]
at org.springframework.boot.DefaultBootstrapContext.getInstance(DefaultBootstrapContext.java:119) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.boot.DefaultBootstrapContext.getOrElseThrow(DefaultBootstrapContext.java:111) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.boot.DefaultBootstrapContext.get(DefaultBootstrapContext.java:88) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.cloud.zookeeper.CuratorFactory.lambda$registerCurator$4(CuratorFactory.java:98) ~[spring-cloud-zookeeper-core-3.0.2.jar:3.0.2]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.boot.DefaultBootstrapContext.close(DefaultBootstrapContext.java:133) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:405) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:144) [spring-boot-2.4.5.jar:2.4.5]
at org.springframework.cloud.context.refresh.LegacyContextRefresher.addConfigFilesToEnvironment(LegacyContextRefresher.java:78) [spring-cloud-context-3.0.2.jar:3.0.2]
at org.springframework.cloud.context.refresh.LegacyContextRefresher.updateEnvironment(LegacyContextRefresher.java:56) [spring-cloud-context-3.0.2.jar:3.0.2]
at org.springframework.cloud.context.refresh.ContextRefresher.refreshEnvironment(ContextRefresher.java:101) [spring-cloud-context-3.0.2.jar:3.0.2]
at org.springframework.cloud.context.refresh.ContextRefresher.refresh(ContextRefresher.java:94) [spring-cloud-context-3.0.2.jar:3.0.2]
at org.springframework.cloud.endpoint.RefreshEndpoint.refresh(RefreshEndpoint.java:41) [spring-cloud-context-3.0.2.jar:3.0.2]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_271]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_271]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_271]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_271]
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) [spring-core-5.3.6.jar:5.3.6]
at org.springframework.boot.actuate.endpoint.invoke.reflect.ReflectiveOperationInvoker.invoke(ReflectiveOperationInvoker.java:77) [spring-boot-actuator-2.4.5.jar:2.4.5]
at org.springframework.boot.actuate.endpoint.annotation.AbstractDiscoveredOperation.invoke(AbstractDiscoveredOperation.java:60) [spring-boot-actuator-2.4.5.jar:2.4.5]
at org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$ServletWebOperationAdapter.handle(AbstractWebMvcEndpointHandlerMapping.java:290) [spring-boot-actuator-2.4.5.jar:2.4.5]
at org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(AbstractWebMvcEndpointHandlerMapping.java:373) [spring-boot-actuator-2.4.5.jar:2.4.5]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_271]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_271]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_271]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_271]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197) [spring-web-5.3.6.jar:5.3.6]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141) [spring-web-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) [spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894) [spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) [spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) [spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060) [spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) [spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) [spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) [spring-webmvc-5.3.6.jar:5.3.6]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:652) [tomcat-embed-core-9.0.45.jar:4.0.FR]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) [spring-webmvc-5.3.6.jar:5.3.6]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) [tomcat-embed-core-9.0.45.jar:4.0.FR]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-embed-websocket-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) [spring-web-5.3.6.jar:5.3.6]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.6.jar:5.3.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) [spring-web-5.3.6.jar:5.3.6]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.6.jar:5.3.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) [spring-boot-actuator-2.4.5.jar:2.4.5]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.6.jar:5.3.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) [spring-web-5.3.6.jar:5.3.6]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.6.jar:5.3.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1707) [tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.45.jar:9.0.45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_271]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_271]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.45.jar:9.0.45]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_271]
2021-04-23 21:58:00.554 DEBUG 49023 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet : Failed to complete request: java.lang.IllegalStateException: org.springframework.boot.context.properties.bind.Binder has not been registered
2021-04-23 21:58:00.556 ERROR 49023 --- [nio-8081-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: org.springframework.boot.context.properties.bind.Binder has not been registered] with root cause
@CookieNuts if that is still an issue in 2020.0.3 please open a new issue in spring cloud zookeeper
Hi All,
I am encountering the below error upon calling
/actuator/refresh
on Config Client usingDiscovery First Bootstrap
approach with Consul.Using Spring Boot
v2.4.1
with Spring Cloud Config Dependenciesv3.0.1
I tried the same with
Config First Bootstrap
approach and can see/actuator/refresh
working as expected by reloading the configs fromconfig-server
Sample Code is available in git repo - https://github.com/2much2learn/article_2021_jan_spring-cloud-config-configfirst_discoveryfirst
Run the below series of commands to replicate the issue
Any help would be appriciated.
Thanks, Madan N