Tencent / spring-cloud-tencent

Spring Cloud Tencent is a Spring Cloud based Service Governance Framework provided by Tencent.
Other
3.17k stars 491 forks source link

Jackson版本导致引入cloud-tencent依赖后无法启动问题 #1285

Closed fwdragon closed 4 months ago

fwdragon commented 5 months ago

The calling method's class was loaded from the following location:

file:/C:/Users/fwdragon/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.13.5/jackson-dataformat-yaml-2.13.5.jar

The called method's class, org.yaml.snakeyaml.parser.ParserImpl, is available from the following locations:

jar:file:/C:/Users/fwdragon/.m2/repository/org/yaml/snakeyaml/2.0/snakeyaml-2.0.jar!/org/yaml/snakeyaml/parser/ParserImpl.class
jar:file:/C:/Users/fwdragon/.m2/repository/com/tencent/cloud/spring-cloud-starter-tencent-all/1.12.4-2021.0.8/spring-cloud-starter-tencent-all-1.12.4-2021.0.8.jar!/org/yaml/snakeyaml/parser/ParserImpl.class

The called method's class hierarchy was loaded from the following locations:

org.yaml.snakeyaml.parser.ParserImpl: file:/C:/Users/fwdragon/.m2/repository/org/yaml/snakeyaml/2.0/snakeyaml-2.0.jar

Action:

Correct the classpath of your application so that it contains compatible versions of the classes com.fasterxml.jackson.dataformat.yaml.YAMLParser and org.yaml.snakeyaml.parser.ParserImpl

查找了历史lssues,遂升级版本,但依然无效 依赖版本如下: spring-cloud-starter-tencent-all:1.12.4-2021.0.8 spring.boot:2.7.11 spring.cloud:2021.0.7 期待您的回答,感谢

SkyeBeFreeman commented 5 months ago

@fwdragon 看了下,这个问题是snakeyaml 2.0引入的。

  1. 可以先尝试不使用sct-all包的引入方式,例如引入discovery、config这些模块。
  2. jackson 2.13.5不支持snakeyaml 2.0,所以jackson也需要升级到2.14.3。

后续版本会考虑修复这个问题。

SkyeBeFreeman commented 5 months ago

也可以使用2022版本sct,支持snakeyaml 2.0版本。

fwdragon commented 5 months ago

也可以使用2022版本sct,支持snakeyaml 2.0版本。

好的 收到 十分感谢 我这边再试试

fwdragon commented 5 months ago

jackson

排除jackson之后解决了 感谢

SkyeBeFreeman commented 4 months ago

spring boot 2.7.18版本默认引入的jackson版本是2.13.5,不支持snakeyaml 2.0及以上版本。如果需要使用snakeyaml 2.0及以上版本,需要同步手动升级jackson版本到2.14.3及以上版本。

image