-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2021.0.1.0 搭配nacos 2.0.4报错 #2431
Comments
我记得这个是优先适配的1.x版本的 |
还望群主大大给与支持。现在线上使用的2.*的版本。 |
看了一下源码,Nacos 2.x比1.x,StringUtils.isBlank构造方法,从String改成了Charsequence,按理应该兼容的 |
可以使用使用nacos 2.0.4试一试。确实报错了。 |
是否存在这个问题:classpath下,既有1.4.3,又有2.0.4的nacos包 |
使用 spring.config.import方式导入,去掉bootstrap starter启动会出错。 |
是有这个问题
APPLICATION FAILED TO START Description: An attempt was made to call a method that does not exist. The attempt was made from the following location:
The following method did not exist:
The calling method's class, com.alibaba.cloud.nacos.configdata.NacosConfigDataLocationResolver, was loaded from the following location:
The called method's class, com.alibaba.nacos.common.utils.StringUtils, is available from the following locations:
The called method's class hierarchy was loaded from the following locations:
Action: Correct the classpath of your application so that it contains compatible versions of the classes com.alibaba.cloud.nacos.configdata.NacosConfigDataLocationResolver and com.alibaba.nacos.common.utils.StringUtils |
那么,是否已经确定,不是包升级的问题,而是使用上可能带来的问题? |
Spring Boot 2.6,有不少底层机制都有变动,有些问题,Spring Cloud & Spring Boot可能未必也考虑到了,例如:在低版本使用的方式在高版本未必能用。这个,我们也在探索中 |
Action: CharSequence 与 String 参数不一致。Override了方法之后启动正常。 public static boolean isBlank(final CharSequence cs) { |
这里应该是一个失误,使用到了nacos的 StringUtil :-) |
期待大大们赶紧修复下,现在引用如果不自己重写类就无法启动。 |
Fixed. |
nacos 客户端版本大于等于 2.0.3 时会出现该问题,使用 2021.0.1.0 版本时,nacos-client 版本要在 2.0.3 以下 |
这样一些方法,尽量使用common-langs,避免兼容性问题 |
java.lang.NoSuchMethodError: com.alibaba.nacos.common.utils.StringUtils.isBlank(Ljava/lang/String;)Z
at com.alibaba.cloud.nacos.configdata.NacosConfigDataLocationResolver.getUri(NacosConfigDataLocationResolver.java:176)
at com.alibaba.cloud.nacos.configdata.NacosConfigDataLocationResolver.loadConfigDataResources(NacosConfigDataLocationResolver.java:158)
at com.alibaba.cloud.nacos.configdata.NacosConfigDataLocationResolver.resolveProfileSpecific(NacosConfigDataLocationResolver.java:151)
at org.springframework.boot.context.config.ConfigDataLocationResolvers.lambda$resolve$2(ConfigDataLocationResolvers.java:120)
at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:126)
at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:119)
at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:107)
at org.springframework.boot.context.config.ConfigDataImporter.resolve(ConfigDataImporter.java:105)
at org.springframework.boot.context.config.ConfigDataImporter.resolve(ConfigDataImporter.java:97)
at org.springframework.boot.context.config.ConfigDataImporter.resolveAndLoad(ConfigDataImporter.java:85)
at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.withProcessedImports(ConfigDataEnvironmentContributors.java:116)
at org.springframework.boot.context.config.ConfigDataEnvironment.processWithProfiles(ConfigDataEnvironment.java:311)
at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:232)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:102)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:94)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:102)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:87)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:85)
at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:66)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1378)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:120)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:114)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:65)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:338)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:296)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292)
at cn.com.xuct.calendar.gateway.GatewayApplication.main(GatewayApplication.java:32)
The text was updated successfully, but these errors were encountered: