alibaba / nacos

an easy-to-use dynamic service discovery, configuration and service management platform for building cloud native applications.
https://nacos.io
Apache License 2.0
30.27k stars 12.84k forks source link

Nacos refreshing configuration caused Druid connection loss #11896

Closed Kiki513H closed 7 months ago

Kiki513H commented 7 months ago

org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'tdenginDataSource': Could not bind properties to 'DataSource' : prefix=spring.datasource.druid.tdengine, ignoreInvalidFields=false, ignoreUnknownFields=true at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:99) at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:79) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:419) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1762) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:410) at org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder.rebind(ConfigurationPropertiesRebinder.java:138) at org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder.rebind(ConfigurationPropertiesRebinder.java:97) at org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder.rebind(ConfigurationPropertiesRebinder.java:85) at org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder.onApplicationEvent(ConfigurationPropertiesRebinder.java:170) at org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder.onApplicationEvent(ConfigurationPropertiesRebinder.java:53) 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:143) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:437) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:370) at org.springframework.cloud.context.refresh.ContextRefresher.refreshEnvironment(ContextRefresher.java:103) at org.springframework.cloud.context.refresh.ContextRefresher.refresh(ContextRefresher.java:94) at org.springframework.cloud.endpoint.event.RefreshEventListener.handle(RefreshEventListener.java:72) at org.springframework.cloud.endpoint.event.RefreshEventListener.onApplicationEvent(RefreshEventListener.java:61) 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:143) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:437) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:370) at com.alibaba.cloud.nacos.refresh.NacosContextRefresher$1.innerReceive(NacosContextRefresher.java:118) at com.alibaba.nacos.api.config.listener.AbstractSharedListener.receiveConfigInfo(AbstractSharedListener.java:40) at com.alibaba.nacos.client.config.impl.CacheData.lambda$safeNotifyListener$1(CacheData.java:334) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:842) Caused by: org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.datasource.druid.tdengine.connection' to com.alibaba.druid.pool.DruidPooledConnection at org.springframework.boot.context.properties.bind.Binder.handleBindError(Binder.java:392) at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:352) at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$4(Binder.java:478) at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:99) at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:87) at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:63) at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$5(Binder.java:482) at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:596) at org.springframework.boot.context.properties.bind.Binder$Context.withDataObject(Binder.java:582) at org.springframework.boot.context.properties.bind.Binder.bindDataObject(Binder.java:480) at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:419) at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:348) at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:337) at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:267) at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:254) at org.springframework.boot.context.properties.ConfigurationPropertiesBinder.bind(ConfigurationPropertiesBinder.java:94) at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:96) ... 32 common frames omitted Caused by: java.lang.IllegalStateException: Unable to get value for property connection at org.springframework.boot.context.properties.bind.JavaBeanBinder$BeanProperty.lambda$getValue$0(JavaBeanBinder.java:389) at org.springframework.boot.context.properties.bind.DefaultBindConstructorProvider.getBindConstructor(DefaultBindConstructorProvider.java:46) at org.springframework.boot.context.properties.bind.ValueObjectBinder$ValueObject.get(ValueObjectBinder.java:190) at org.springframework.boot.context.properties.bind.ValueObjectBinder.bind(ValueObjectBinder.java:67) at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$5(Binder.java:482) at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:596) at org.springframework.boot.context.properties.bind.Binder$Context.withDataObject(Binder.java:582) at org.springframework.boot.context.properties.bind.Binder.bindDataObject(Binder.java:480) at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:419) at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:348) ... 47 common frames omitted Caused by: java.lang.reflect.InvocationTargetException: null at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.springframework.boot.context.properties.bind.JavaBeanBinder$BeanProperty.lambda$getValue$0(JavaBeanBinder.java:383) ... 56 common frames omitted Caused by: com.alibaba.druid.pool.DataSourceClosedException: dataSource already closed at Fri Mar 29 16:23:26 CST 2024 at com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:1676) at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:1504) at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:5074) at com.alibaba.druid.filter.stat.StatFilter.dataSource_getConnection(StatFilter.java:724) at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:5070) at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1479) at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1469) ... 61 common frames omitted 16:23:29.878 [com.alibaba.nacos.client.Worker] INFO c.a.n.c.c.i.CacheData - [safeNotifyListener,383] - [fixed-f6a93461-6171-41b4-aa94-98e4b4773f1f-172.24.73.24_8848] [notify-listener] time cost=0ms in ClientWorker, dataId=hero-gateway-config.yaml, group=HF_GROUP, md5=8ee2ed5e60a20f5b496a63b84de24214, listener=com.alibaba.cloud.nacos.refresh.NacosContextRefresher$1@2db57be2 16:23:29.879 [nacos.client.cachedata.internal.notifier] INFO c.a.n.c.c.i.CacheData - [lambda$safeNotifyListener$1,319] - [fixed-f6a93461-6171-41b4-aa94-98e4b4773f1f-172.24.73.24_8848] [notify-context] dataId=hero-gateway-config.yaml, group=HF_GROUP, md5=8ee2ed5e60a20f5b496a63b84de24214 16:23:30.223 [nacos.client.cachedata.internal.notifier] WARN c.a.n.c.l.NacosLogging - [loadConfiguration,64] - Load Logback Configuration of Nacos fail, message: Could not initialize Logback Nacos logging from classpath:nacos-logback.xml 16:23:30.229 [nacos.client.cachedata.internal.notifier] WARN c.a.n.c.l.NacosLogging - [loadConfiguration,64] - Load Logback Configuration of Nacos fail, message: Could not initialize Logback Nacos logging from classpath:nacos-logback.xml 16:23:30.252 [nacos.client.cachedata.internal.notifier] WARN c.a.n.c.l.NacosLogging - [loadConfiguration,64] - Load Logback Configuration of Nacos fail, message: Could not initialize Logback Nacos logging from classpath:nacos-logback.xml 16:23:30.306 [nacos.client.cachedata.internal.notifier] WARN c.a.c.n.c.NacosPropertySourceBuilder - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[hero-gateway-config] & group[HF_GROUP] 16:23:30.396 [nacos.client.cachedata.internal.notifier] WARN c.a.c.n.c.NacosPropertySourceBuilder - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[hero-gateway-config-dev.yaml] & group[HF_GROUP] 16:23:30.439 [nacos.client.cachedata.internal.notifier] WARN c.a.c.n.c.NacosPropertySourceBuilder - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[hero-gateway-config-framework.yaml] & group[HF_GROUP] 16:23:30.484 [nacos.client.cachedata.internal.notifier] WARN c.a.c.n.c.NacosPropertySourceBuilder - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[hero-gateway-config-mybatis.yaml] & group[HF_GROUP] 16:23:30.530 [nacos.client.cachedata.internal.notifier] WARN c.a.c.n.c.NacosPropertySourceBuilder - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[hero-gateway-config-mqtt.yaml] & group[HF_GROUP] 16:23:30.573 [nacos.client.cachedata.internal.notifier] WARN c.a.c.n.c.NacosPropertySourceBuilder - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[hero-gateway-config-swagger-client.yaml] & group[HF_GROUP] 16:23:30.606 [nacos.client.cachedata.internal.notifier] WARN c.a.c.n.c.NacosPropertySourceBuilder - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[hero-gateway-config-base.yaml] & group[HF_GROUP] 16:23:30.638 [nacos.client.cachedata.internal.notifier] WARN c.a.c.n.c.NacosPropertySourceBuilder - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[hero-gateway-config-biz.yaml] & group[HF_GROUP] 16:23:30.670 [nacos.client.cachedata.internal.notifier] WARN c.a.c.n.c.NacosPropertySourceBuilder - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[hero-gateway-config-other.yaml] & group[HF_GROUP] 16:23:30.688 [nacos.client.cachedata.internal.notifier] WARN c.a.n.c.l.NacosLogging - [loadConfiguration,64] - Load Logback Configuration of Nacos fail, message: Could not initialize Logback Nacos logging from classpath:nacos-logback.xml 16:23:30.720 [nacos.client.cachedata.internal.notifier] INFO c.a.d.p.DruidDataSource - [close,2212] - {dataSource-2} closing ... 16:23:30.727 [nacos.client.cachedata.internal.notifier] ERROR c.a.n.c.c.i.CacheData - [lambda$safeNotifyListener$1,351] - [fixed-f6a93461-6171-41b4-aa94-98e4b4773f1f-172.24.73.24_8848] [notify-error] dataId=hero-gateway-config.yaml, group=HF_GROUP, md5=8ee2ed5e60a20f5b496a63b84de24214, listener=com.alibaba.cloud.nacos.refresh.NacosContextRefresher$1@2db57be2 org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'tdenginDataSource': Could not bind properties to 'DataSource' : prefix=spring.datasource.druid.tdengine, ignoreInvalidFields=false, ignoreUnknownFields=true at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:99) at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:79) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:419) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1762) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:410) at org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder.rebind(ConfigurationPropertiesRebinder.java:138) at org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder.rebind(ConfigurationPropertiesRebinder.java:97) at org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder.rebind(ConfigurationPropertiesRebinder.java:85) at org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder.onApplicationEvent(ConfigurationPropertiesRebinder.java:170) at org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder.onApplicationEvent(ConfigurationPropertiesRebinder.java:53) 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:143) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:437) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:370) at org.springframework.cloud.context.refresh.ContextRefresher.refreshEnvironment(ContextRefresher.java:103) at org.springframework.cloud.context.refresh.ContextRefresher.refresh(ContextRefresher.java:94) at org.springframework.cloud.endpoint.event.RefreshEventListener.handle(RefreshEventListener.java:72) at org.springframework.cloud.endpoint.event.RefreshEventListener.onApplicationEvent(RefreshEventListener.java:61) 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:143) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:437) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:370) at com.alibaba.cloud.nacos.refresh.NacosContextRefresher$1.innerReceive(NacosContextRefresher.java:118) at com.alibaba.nacos.api.config.listener.AbstractSharedListener.receiveConfigInfo(AbstractSharedListener.java:40) at com.alibaba.nacos.client.config.impl.CacheData.lambda$safeNotifyListener$1(CacheData.java:334) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:842) Caused by: org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.datasource.druid.tdengine.connection' to com.alibaba.druid.pool.DruidPooledConnection at org.springframework.boot.context.properties.bind.Binder.handleBindError(Binder.java:392) at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:352) at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$4(Binder.java:478) at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:99) at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:87) at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:63) at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$5(Binder.java:482) at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:596) at org.springframework.boot.context.properties.bind.Binder$Context.withDataObject(Binder.java:582) at org.springframework.boot.context.properties.bind.Binder.bindDataObject(Binder.java:480) at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:419) at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:348) at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:337) at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:267) at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:254) at org.springframework.boot.context.properties.ConfigurationPropertiesBinder.bind(ConfigurationPropertiesBinder.java:94) at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:96) ... 32 common frames omitted Caused by: java.lang.IllegalStateException: Unable to get value for property connection at org.springframework.boot.context.properties.bind.JavaBeanBinder$BeanProperty.lambda$getValue$0(JavaBeanBinder.java:389) at org.springframework.boot.context.properties.bind.DefaultBindConstructorProvider.getBindConstructor(DefaultBindConstructorProvider.java:46) at org.springframework.boot.context.properties.bind.ValueObjectBinder$ValueObject.get(ValueObjectBinder.java:190) at org.springframework.boot.context.properties.bind.ValueObjectBinder.bind(ValueObjectBinder.java:67) at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$5(Binder.java:482) at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:596) at org.springframework.boot.context.properties.bind.Binder$Context.withDataObject(Binder.java:582) at org.springframework.boot.context.properties.bind.Binder.bindDataObject(Binder.java:480) at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:419) at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:348) ... 47 common frames omitted Caused by: java.lang.reflect.InvocationTargetException: null at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.springframework.boot.context.properties.bind.JavaBeanBinder$BeanProperty.lambda$getValue$0(JavaBeanBinder.java:383) ... 56 common frames omitted Caused by: com.alibaba.druid.pool.DataSourceClosedException: dataSource already closed at Fri Mar 29 16:23:26 CST 2024 at com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:1676) at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:1504) at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:5074) at com.alibaba.druid.filter.stat.StatFilter.dataSource_getConnection(StatFilter.java:724) at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:5070) at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1479) at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1469) ... 61 common frames omitted

KomachiSion commented 7 months ago

It's not nacos' problem, not only push new config to app. For how to use this new config is not nacos' responsibility.