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.24k stars 12.83k forks source link

nacos 获取 project.version失败 #3421

Closed LittleM318 closed 4 years ago

LittleM318 commented 4 years ago

Issue Description

通过nacos配置中心更新配置文件失败 报错:Could not resolve placeholder 'project.version' in value "${project.version}" Type: bug report or feature request

Describe what happened (or what feature you want)

2020-07-23 10:38:14.326 - INFO 22456 [13-c60811fd1f04] c.a.nacos.client.config.impl.CacheData : [fixed-172.21.9.17_8848-172.21.9.172_8849-172.21.9.172_8850-38f49afe-a85d-4e2e-a813-c60811fd1f04] [notify-context] dataId=ubp-cloud-order, group=com.unionpay.ubp.dev, md5=d1226b205ea0fea791dddae3d6372046

2020-07-23 10:38:14.330 -ERROR 22456 [13-c60811fd1f04] c.a.nacos.client.config.impl.CacheData : [fixed-172.21.9.17_8848-172.21.9.172_8849-172.21.9.172_8850-38f49afe-a85d-4e2e-a813-c60811fd1f04] [notify-error] dataId=ubp-cloud-order, group=com.unionpay.ubp.dev, md5=d1226b205ea0fea791dddae3d6372046, listener=com.alibaba.cloud.nacos.refresh.NacosContextRefresher$1@6a29d1b5 tx={}

java.lang.IllegalArgumentException: Could not resolve placeholder 'project.version' in value "${project.version}"

  at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178)

  at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124)

  at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:236)

  at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210)

  at org.springframework.core.env.AbstractEnvironment.resolveRequiredPlaceholders(AbstractEnvironment.java:571)

  at java.util.Optional.map(Optional.java:215)

  at com.ulisesbocchio.jasyptspringboot.resolver.DefaultPropertyResolver.resolvePropertyValue(DefaultPropertyResolver.java:38)

  at com.ulisesbocchio.jasyptspringboot.resolver.DefaultLazyPropertyResolver.resolvePropertyValue(DefaultLazyPropertyResolver.java:42)

  at com.ulisesbocchio.jasyptspringboot.EncryptablePropertySource.getProperty(EncryptablePropertySource.java:20)

  at com.ulisesbocchio.jasyptspringboot.caching.CachingDelegateEncryptablePropertySource.lambda$getProperty$0(CachingDelegateEncryptablePropertySource.java:34)

  at org.springframework.cache.concurrent.ConcurrentMapCache.lambda$get$0(ConcurrentMapCache.java:146)

  at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)

  at org.springframework.cache.concurrent.ConcurrentMapCache.get(ConcurrentMapCache.java:144)

  at com.ulisesbocchio.jasyptspringboot.caching.CachingDelegateEncryptablePropertySource.getProperty(CachingDelegateEncryptablePropertySource.java:34)

  at com.ulisesbocchio.jasyptspringboot.wrapper.EncryptableMapPropertySourceWrapper.getProperty(EncryptableMapPropertySourceWrapper.java:31)

  at org.springframework.cloud.context.refresh.ContextRefresher.extract(ContextRefresher.java:253)

  at org.springframework.cloud.context.refresh.ContextRefresher.extract(ContextRefresher.java:229)

  at org.springframework.cloud.context.refresh.ContextRefresher.refreshEnvironment(ContextRefresher.java:91)

  at org.springframework.cloud.context.refresh.ContextRefresher.refresh(ContextRefresher.java:85)

  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:139)

  at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403)

  at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360)

  at com.alibaba.cloud.nacos.refresh.NacosContextRefresher$1.innerReceive(NacosContextRefresher.java:133)

  at com.alibaba.nacos.api.config.listener.AbstractSharedListener.receiveConfigInfo(AbstractSharedListener.java:38)

  at com.alibaba.nacos.client.config.impl.CacheData$1.run(CacheData.java:203)

  at com.alibaba.nacos.client.config.impl.CacheData.safeNotifyListener(CacheData.java:233)

  at com.alibaba.nacos.client.config.impl.CacheData.checkListenerMd5(CacheData.java:174)

  at com.alibaba.nacos.client.config.impl.ClientWorker$LongPollingRunnable.run(ClientWorker.java:552)

  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

  at java.util.concurrent.FutureTask.run(FutureTask.java:266)

  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)

  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)

  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)

2020-07-23 10:38:14.331 - INFO 22456 [13-c60811fd1f04] c.a.nacos.client.config.impl.CacheData : [fixed-172.21.9.17_8848-172.21.9.172_8849-172.21.9.172_8850-38f49afe-a85d-4e2e-a813-c60811fd1f04] [notify-listener] time cost=5ms in ClientWorker, dataId=ubp-cloud-order, group=com.unionpay.ubp.dev, md5=d1226b205ea0fea791dddae3d6372046, listener=com.alibaba.cloud.nacos.refresh.NacosContextRefresher$1@6a29d1b5

Describe what you expected to happen

How to reproduce it (as minimally and precisely as possible)

Tell us your environment

springboot2.2.6.release spring-cloud-starter-alibaba-nacos-config 2.2.1.release

Anything else we need to know?

LittleM318 commented 4 years ago

补充:启动的时候没有这个问题,能正确读取到nacos配置中心的配置,但是更新了配置中心的配置后,报这个错误,并且本地的配置没有被更新。该错误每30秒均会抛出。

markofrain commented 4 years ago

@LittleM318 你很可能用了jasypt-spring-boot-starter,建议将此升级为3.0版本可以解决此问题

KomachiSion commented 4 years ago

duplicate with #3528

LittleM318 commented 4 years ago

@LittleM318 你很可能用了jasypt-spring-boot-starter,建议将此升级为3.0版本可以解决此问题

感谢大佬,就是这个问题。

awesometype commented 3 years ago

@LittleM318 你很可能用了jasypt-spring-boot-starter,建议将此升级为3.0版本可以解决此问题

是的大佬,确实是这个问题,但是为啥呢?