Skip to content
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

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

Open
Bing-ok opened this issue Nov 14, 2023 · 1 comment

Comments

@Bing-ok
Copy link

Bing-ok commented Nov 14, 2023

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 ()>
  1. 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
Copy link

bigfish1913 commented Nov 14, 2023 via email

@Bing-ok Bing-ok changed the title “NoSuchMethodErrors” due to multiple versions of io.dropwizard.metrics:metrics-core:jar “NoSuchMethodErrors” due to multiple versions of com.fasterxml.jackson.core:jackson-databind:jar Nov 14, 2023
@Bing-ok Bing-ok changed the title “NoSuchMethodErrors” due to multiple versions of com.fasterxml.jackson.core:jackson-databind:jar “NoSuchMethodErrors” due to multiple versions of com.fasterxml.jackson.core:jackson-core:jar Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants