qunarcorp / bistoury

Bistoury是去哪儿网的java应用生产问题诊断工具,提供了一站式的问题诊断方案
GNU General Public License v3.0
4.02k stars 825 forks source link

“NoSuchMethodErrors” due to multiple versions of com.fasterxml.jackson.core:jackson-core:jar #170

Open Bing-ok opened 10 months ago

Bing-ok commented 10 months ago

Issue description

Hi, there are multiple versions of com.fasterxml.jackson.core:jackson-core in bistoury-ui:v2.0.7. As shown in the following dependency tree, according to Maven "nearest wins" strategy, only com.fasterxml.jackson.core:jackson-core:2.9.2 can be loaded, com.fasterxml.jackson.core:jackson-core:2.5.3 will be shadowed.

However, several methods defined in shadowed version com.fasterxml.jackson.core:jackson-core:2.5.3 are referenced by client project via qunar.tc.bistoury:bistoury-metrics-prometheus:2.0.7, qunar.tc.bistoury:bistoury-ui-service-impl:2.0.7 and com.fasterxml.jackson.core:jackson-databind:2.9.2 but missing in the actually loaded version com.fasterxml.jackson.core:jackson-core:2.9.2.

For instance, the following missing method(defined in com.fasterxml.jackson.core:jackson-core:2.5.3) are actually referenced by bistoury-ui, which will introduce a runtime error(i.e., "NoSuchMethodError") into bistoury-ui.

  1. com.fasterxml.jackson.core.type.TypeReference: void init () is invoked by bistoury-ui:v2.0.7 via the following path:

    paths------
    <qunar.tc.bistoury.ui.controller.ProfilerController$1: void init (qunar.tc.bistoury.ui.controller.ProfilerController)> qunar.tc.bistoury:bistoury-ui:2.0.7; 
    <com.fasterxml.jackson.core.type.TypeReference: void init ()>
  2. com.codahale.metrics.MetricRegistry: com.codahale.metrics.Timer timer(java.lang.String,com.codahale.metrics.MetricRegistry$MetricSupplier) is invoked by bistoury-ui:v2.0.7 via the following path:

    paths------
    <qunar.tc.bistoury.ui.controller.GitlabRepositoryApiController: qunar.tc.bistoury.serverside.bean.ApiResult file(java.lang.String,java.lang.String,java.lang.String,java.lang.String)> qunar.tc.bistoury:bistoury-ui:2.0.7; 
    <qunar.tc.bistoury.ui.service.impl.GitRepositoryStoreServiceImpl: qunar.tc.bistoury.serverside.bean.ApiResult fileByClass(java.lang.String,java.lang.String,java.lang.String,java.lang.String)> qunar.tc.bistoury:bistoury-ui-service-impl:2.0.7; 
    <qunar.tc.bistoury.ui.git.GitlabRepositoryApiImpl: qunar.tc.bistoury.serverside.bean.ApiResult fileByClass(java.lang.String,java.lang.String,java.lang.String,java.lang.String)> qunar.tc.bistoury:bistoury-ui-service-impl:2.0.7; 
    <qunar.tc.bistoury.ui.git.GitlabRepositoryApiImpl: qunar.tc.bistoury.serverside.bean.ApiResult doFile(java.lang.String,java.lang.String,java.lang.String)> qunar.tc.bistoury:bistoury-ui-service-impl:2.0.7; 
    <qunar.tc.bistoury.ui.git.GitlabRepositoryApiImpl: org.gitlab.api.GitlabAPI createGitlabApi()> qunar.tc.bistoury:bistoury-ui-service-impl:2.0.7; 
    <org.gitlab.api.GitlabAPI: void clinit ()> org.gitlab:java-gitlab-api:1.2.5; 
    <com.fasterxml.jackson.core.ObjectCodec: void init ()>

Suggested fixing solutions:

  1. Change direct dependency com.fasterxml.jackson.core:jackson-core from 2.9.2 to 2.5.3. Because version 2.5.3 includes the above missing methods and is compatible with other versions of com.fasterxml.jackson.core:jackson-core in the project.

Please let me know if the solution is useful? I can submit a PR to fix it.

Thank you very much for your attention. Best regards,

Dependency tree --


[INFO] |     |  +- io.netty:netty-all:jar:4.1.41.Final:compile
[INFO] |     |  \- (org.slf4j:slf4j-api:jar:1.7.5:compile - version managed from 1.7.25; omitted for duplicate)
[INFO] |     +- qunar.tc.bistoury:bistoury-common:jar:2.0.7:compile
[INFO] |     |  +- (com.google.guava:guava:jar:20.0:compile - version managed from 16.0.1; omitted for duplicate)
[INFO] |     |  +- joda-time:joda-time:jar:2.9:compile
[INFO] |     |  +- (com.fasterxml.jackson.core:jackson-core:jar:2.9.2:compile - version managed from 2.5.3; omitted for duplicate)
[INFO] |     |  +- (com.fasterxml.jackson.core:jackson-databind:jar:2.9.2:compile - version managed from 2.5.3; omitted for duplicate)
[INFO] |     |  +- (com.fasterxml.jackson.core:jackson-annotations:jar:2.9.2:compile - version managed from 2.9.0; omitted for duplicate)
[INFO] |     |  +- com.ning:async-http-client:jar:1.9.39:compile
[INFO] |     |  |  +- (io.netty:netty:jar:3.10.5.Final:compile - version managed from 3.7.0.Final; omitted for duplicate)
[INFO] |     |  |  \- (org.slf4j:slf4j-api:jar:1.7.5:compile - version managed from 1.7.12; omitted for duplicate)
bigfish1913 commented 10 months ago

这是来自QQ邮箱的自动回复邮件。    来信已经收到 感谢您的来信  付威