scireum / s3ninja

S3 ninja emulates the Amazon S3 API for developement and test purposes
MIT License
493 stars 91 forks source link

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

Closed Bing-ok closed 4 years ago

Bing-ok commented 4 years ago

Issue description

Hi, there are multiple versions of com.fasterxml.jackson.core:jackson-databind in s3ninja. As shown in the following dependency tree, according to Maven's “nearest wins” strategy, only com.fasterxml.jackson.core:jackson-databind:2.6.7.2 can be loaded, com.fasterxml.jackson.core:jackson-databind:2.9.8 will be shadowed.

Howeve, several methods defined in shadowed version com.fasterxml.jackson.core:jackson-databind:2.9.8 are referenced by client project via com.scireum:sirius-kernel:14.0, but missing in the actually loaded version com.fasterxml.jackson.core:jackson-databind:2.6.7.2

For intance, the following missing methods(defined in com.scireum:sirius-kernel:14.0) are actually referenced by s3ninja, which will introduced a runtime error(i.e., "NoSuchMethodErrors") into s3ninja.

1. com.fasterxml.jackson.databind.ser.std.MapProperty: void reset(java.lang.Object,java.lang.Object,com.fasterxml.jackson.databind.JsonSerializer,com.fasterxml.jackson.databind.JsonSerializer) is invoked by s3ninja via the following path:


paths------
<ninja.APILog$Entry: void (java.lang.String,java.lang.String,java.lang.String,java.lang.String)> s3ninja\target\classes
<sirius.kernel.nls.NLS: java.lang.String toUserString(java.lang.Object)> Repositories\com\scireum\sirius-kernel\14.0\sirius-kernel-14.0.jar
<sirius.kernel.nls.NLS: java.lang.String getCurrentLang()> Repositories\com\scireum\sirius-kernel\14.0\sirius-kernel-14.0.jar
<sirius.kernel.async.CallContext: java.lang.String getLang()> Repositories\com\scireum\sirius-kernel\14.0\sirius-kernel-14.0.jar
<com.fasterxml.jackson.datatype.jdk8.StreamSerializer$lambda_serialize_0__129: void accept(java.lang.Object)> 
<com.fasterxml.jackson.datatype.jdk8.StreamSerializer: void lambda$serialize$0(com.fasterxml.jackson.databind.SerializerProvider,com.fasterxml.jackson.core.JsonGenerator,java.lang.Object)> Repositories\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.8\jackson-datatype-jdk8-2.9.8.jar
<com.fasterxml.jackson.datatype.guava.ser.MultimapSerializer: void serialize(java.lang.Object,com.fasterxml.jackson.core.JsonGenerator,com.fasterxml.jackson.databind.SerializerProvider)> Repositories\com\fasterxml\jackson\datatype\jackson-datatype-guava\2.9.8\jackson-datatype-guava-2.9.8.jar
<com.fasterxml.jackson.datatype.guava.ser.MultimapSerializer: void serialize(com.google.common.collect.Multimap,com.fasterxml.jackson.core.JsonGenerator,com.fasterxml.jackson.databind.SerializerProvider)> Repositories\com\fasterxml\jackson\datatype\jackson-datatype-guava\2.9.8\jackson-datatype-guava-2.9.8.jar
<com.fasterxml.jackson.datatype.guava.ser.MultimapSerializer: void serializeFilteredFields(com.google.common.collect.Multimap,com.fasterxml.jackson.core.JsonGenerator,com.fasterxml.jackson.databind.SerializerProvider)> Repositories\com\fasterxml\jackson\datatype\jackson-datatype-guava\2.9.8\jackson-datatype-guava-2.9.8.jar
<com.fasterxml.jackson.databind.ser.std.MapProperty: void reset(java.lang.Object,java.lang.Object,com.fasterxml.jackson.databind.JsonSerializer,com.fasterxml.jackson.databind.JsonSerializer)> 

2. com.fasterxml.jackson.databind.jsontype.TypeSerializer: com.fasterxml.jackson.core.type.WritableTypeId typeId(java.lang.Object,com.fasterxml.jackson.core.JsonToken) is invoked by s3ninja via the following path:


paths------
<ninja.APILog$Entry: void init(java.lang.String,java.lang.String,java.lang.String,java.lang.String)> s3ninja\target\classes
<sirius.kernel.nls.NLS: java.lang.String toUserString(java.lang.Object)> Repositories\com\scireum\sirius-kernel\14.0\sirius-kernel-14.0.jar
<sirius.kernel.nls.NLS: java.lang.String getCurrentLang()> Repositories\com\scireum\sirius-kernel\14.0\sirius-kernel-14.0.jar
<sirius.kernel.async.CallContext: java.lang.String getLang()> Repositories\com\scireum\sirius-kernel\14.0\sirius-kernel-14.0.jar
<com.fasterxml.jackson.datatype.jdk8.StreamSerializer$lambda_serialize_0__129: void accept(java.lang.Object)> 
<com.fasterxml.jackson.datatype.jdk8.StreamSerializer: void lambda$serialize$0(com.fasterxml.jackson.databind.SerializerProvider,com.fasterxml.jackson.core.JsonGenerator,java.lang.Object)> Repositories\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.8\jackson-datatype-jdk8-2.9.8.jar
<com.fasterxml.jackson.databind.ser.std.ReferenceTypeSerializer: void serialize(java.lang.Object,com.fasterxml.jackson.core.JsonGenerator,com.fasterxml.jackson.databind.SerializerProvider)> 
<com.fasterxml.jackson.datatype.jsr310.ser.JSR310SerializerBase: void serializeWithType(java.lang.Object,com.fasterxml.jackson.core.JsonGenerator,com.fasterxml.jackson.databind.SerializerProvider,com.fasterxml.jackson.databind.jsontype.TypeSerializer)> Repositories\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.8\jackson-datatype-jsr310-2.9.8.jar
<com.fasterxml.jackson.databind.jsontype.TypeSerializer: com.fasterxml.jackson.core.type.WritableTypeId typeId(java.lang.Object,com.fasterxml.jackson.core.JsonToken)> 

3. com.fasterxml.jackson.databind.JsonMappingException: com.fasterxml.jackson.databind.JsonMappingException 'from'(com.fasterxml.jackson.core.JsonGenerator,java.lang.String) is invoked by s3ninja via the following path:


paths------
<ninja.APILog$Entry: void (java.lang.String,java.lang.String,java.lang.String,java.lang.String)> s3ninja\target\classes
<sirius.kernel.nls.NLS: java.lang.String toUserString(java.lang.Object)> Repositories\com\scireum\sirius-kernel\14.0\sirius-kernel-14.0.jar
<sirius.kernel.nls.NLS: java.lang.String getCurrentLang()> Repositories\com\scireum\sirius-kernel\14.0\sirius-kernel-14.0.jar
<sirius.kernel.async.CallContext: java.lang.String getLang()> Repositories\com\scireum\sirius-kernel\14.0\sirius-kernel-14.0.jar
<com.fasterxml.jackson.datatype.jdk8.StreamSerializer$lambda_serialize_0__129: void accept(java.lang.Object)> 
<com.fasterxml.jackson.datatype.jdk8.StreamSerializer: void lambda$serialize$0(com.fasterxml.jackson.databind.SerializerProvider,com.fasterxml.jackson.core.JsonGenerator,java.lang.Object)> Repositories\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.8\jackson-datatype-jdk8-2.9.8.jar
<com.fasterxml.jackson.datatype.jsr310.ser.key.Jsr310NullKeySerializer: void serialize(java.lang.Object,com.fasterxml.jackson.core.JsonGenerator,com.fasterxml.jackson.databind.SerializerProvider)> Repositories\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.8\jackson-datatype-jsr310-2.9.8.jar
<com.fasterxml.jackson.databind.JsonMappingException: com.fasterxml.jackson.databind.JsonMappingException 'from'(com.fasterxml.jackson.core.JsonGenerator,java.lang.String)> 

Suggested fixing solutions

  1. Declare a direct dependency Upgrade dependency com.fasterxml.jackson.core:jackson-databind:2.9.8 in the pom file of s3ninja to upgrade version from 2.6.7.2 to 2.9.8.
  2. Use configuration attribute <dependencyManagement> to unify the version of library com.fasterxml.jackson.core:jackson-databind to be 2.9.8 in s3ninja's pom file.

Please let me know which solution do you prefer? I can submit a PR to fix it.

Thank you very much for your attention. Best regards,

Dependency tree----


[INFO] com.scireum:s3ninja:jar:DEVELOPMENT-SNAPSHOT
[INFO] +- com.scireum:sirius-web:jar:25.0:compile
[INFO] |  +- (com.scireum:sirius-kernel:jar:14.0:compile - omitted for duplicate)
[INFO] |  +- io.netty:netty-all:jar:4.1.42.Final:compile
[INFO] |  +- com.scireum:server-sass:jar:5.0.1:compile
[INFO] |  |  \- com.scireum:parsii:jar:4.0:compile
[INFO] |  +- com.alibaba:fastjson:jar:1.2.62:compile
[INFO] |  +- com.ning:async-http-client:jar:1.9.40:compile
[INFO] |  |  +- io.netty:netty:jar:3.10.6.Final:compile
[INFO] |  |  \- org.slf4j:slf4j-api:jar:1.7.12:compile
[INFO] |  +- com.google.zxing:core:jar:3.4.0:compile
[INFO] |  +- com.google.zxing:javase:jar:3.4.0:compile
[INFO] |  |  +- (com.google.zxing:core:jar:3.4.0:compile - omitted for duplicate)
[INFO] |  |  +- com.beust:jcommander:jar:1.72:compile
[INFO] |  |  \- com.github.jai-imageio:jai-imageio-core:jar:1.4.0:runtime
[INFO] |  +- javax.mail:mail:jar:1.4.7:compile
[INFO] |  |  \- javax.activation:activation:jar:1.1:compile
[INFO] |  +- net.markenwerk:utils-mail-dkim:jar:1.1.7:compile
[INFO] |  |  +- net.iharder:base64:jar:2.3.9:compile
[INFO] |  |  +- net.markenwerk:utils-data-fetcher:jar:4.0.1:compile
[INFO] |  |  |  \- net.markenwerk:commons-nulls:jar:1.0.2:compile
[INFO] |  |  \- com.sun.mail:javax.mail:jar:1.5.5:compile
[INFO] |  |     \- (javax.activation:activation:jar:1.1:compile - omitted for duplicate)
[INFO] |  +- org.xhtmlrenderer:flying-saucer-pdf:jar:9.1.18:compile
[INFO] |  |  +- com.lowagie:itext:jar:2.1.7:compile
[INFO] |  |  \- org.xhtmlrenderer:flying-saucer-core:jar:9.1.18:compile
[INFO] |  +- org.apache.poi:poi:jar:4.1.0:compile
[INFO] |  |  +- commons-codec:commons-codec:jar:1.12:compile
[INFO] |  |  +- org.apache.commons:commons-collections4:jar:4.3:compile
[INFO] |  |  \- org.apache.commons:commons-math3:jar:3.6.1:compile
[INFO] |  \- org.apache.poi:poi-ooxml:jar:4.1.0:compile
[INFO] |     +- (org.apache.poi:poi:jar:4.1.0:compile - omitted for duplicate)
[INFO] |     +- org.apache.poi:poi-ooxml-schemas:jar:4.1.0:compile
[INFO] |     |  \- org.apache.xmlbeans:xmlbeans:jar:3.1.0:compile
[INFO] |     +- org.apache.commons:commons-compress:jar:1.18:compile
[INFO] |     \- com.github.virtuald:curvesapi:jar:1.06:compile
[INFO] +- com.scireum:sirius-kernel:jar:14.0:compile
[INFO] |  +- com.typesafe:config:jar:1.3.4:compile
[INFO] |  +- com.google.guava:guava:jar:21.0:compile
[INFO] |  +- log4j:log4j:jar:1.2.17:compile
[INFO] |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  +- org.slf4j:slf4j-log4j12:jar:1.7.28:compile
[INFO] |  |  +- (org.slf4j:slf4j-api:jar:1.7.28:compile - omitted for conflict with 1.7.12)
[INFO] |  |  \- (log4j:log4j:jar:1.2.17:compile - omitted for duplicate)
[INFO] |  \- com.palantir.docker.compose:docker-compose-rule-core:jar:1.3.0:compile
[INFO] |     +- com.jayway.awaitility:awaitility:jar:1.7.0:compile
[INFO] |     |  +- org.hamcrest:hamcrest-library:jar:1.3:compile
[INFO] |     |  |  \- (org.hamcrest:hamcrest-core:jar:1.3:compile - omitted for duplicate)
[INFO] |     |  +- (org.hamcrest:hamcrest-core:jar:1.3:compile - omitted for conflict with 1.3)
[INFO] |     |  +- cglib:cglib-nodep:jar:3.1:compile
[INFO] |     |  \- (org.objenesis:objenesis:jar:1.0:compile - omitted for conflict with 2.5.1)
[INFO] |     +- com.github.zafarkhaja:java-semver:jar:0.9.0:compile
[INFO] |     +- (com.google.guava:guava:jar:21.0:compile - omitted for duplicate)
[INFO] |     +- commons-io:commons-io:jar:2.4:compile
[INFO] |     +- joda-time:joda-time:jar:2.10.3:compile
[INFO] |     +- org.apache.commons:commons-lang3:jar:3.7:compile
[INFO] |     +- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] |     |  \- org.hamcrest:hamcrest:jar:2.1:compile
[INFO] |     +- (org.slf4j:slf4j-api:jar:1.7.25:compile - omitted for conflict with 1.7.12)
[INFO] |     +- com.palantir.docker.compose:docker-compose-rule-events-api-objects:jar:1.3.0:compile
[INFO] |     |  \- com.palantir.conjure.java:conjure-lib:jar:4.0.0:compile
[INFO] |     |     +- com.fasterxml.jackson.core:jackson-databind:jar:2.6.7.2:compile
[INFO] |     |     |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] |     |     |  \- com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile
[INFO] |     |     +- com.palantir.ri:resource-identifier:jar:1.0.1:compile
[INFO] |     |     |  \- (com.fasterxml.jackson.core:jackson-annotations:jar:2.4.4:runtime - omitted for conflict with 2.9.0)
[INFO] |     |     +- com.palantir.safe-logging:preconditions:jar:1.10.1:compile
[INFO] |     |     |  +- com.palantir.safe-logging:safe-logging:jar:1.10.1:compile
[INFO] |     |     |  \- com.google.errorprone:error_prone_annotations:jar:2.3.3:compile
[INFO] |     |     +- com.palantir.tokens:auth-tokens:jar:3.6.1:compile
[INFO] |     |     |  +- (com.fasterxml.jackson.core:jackson-databind:jar:2.9.9:compile - omitted for duplicate)
[INFO] |     |     |  +- (org.slf4j:slf4j-api:jar:1.7.25:compile - omitted for conflict with 1.7.12)
[INFO] |     |     |  \- (com.palantir.safe-logging:preconditions:jar:1.9.0:runtime - omitted for conflict with 1.10.1)
[INFO] |     |     +- com.palantir.conjure.java.api:errors:jar:2.3.0:compile
[INFO] |     |     |  +- (com.fasterxml.jackson.core:jackson-databind:jar:2.9.7:compile - omitted for conflict with 2.6.7.2)
[INFO] |     |     |  +- (com.google.code.findbugs:jsr305:jar:3.0.2:compile - omitted for duplicate)
[INFO] |     |     |  +- (com.palantir.safe-logging:safe-logging:jar:1.5.1:compile - omitted for conflict with 1.10.1)
[INFO] |     |     |  \- (com.palantir.safe-logging:preconditions:jar:1.5.1:runtime - omitted for conflict with 1.10.1)
[INFO] |     |     +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] |     |     \- javax.ws.rs:javax.ws.rs-api:jar:2.1:compile
[INFO] |     +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.9.9:runtime
[INFO] |     |  +- org.yaml:snakeyaml:jar:1.23:runtime
[INFO] |     |  \- (com.fasterxml.jackson.core:jackson-core:jar:2.9.9:compile - scope updated from runtime; omitted for duplicate)
[INFO] |     +- com.palantir.conjure.java.runtime:conjure-java-jackson-serialization:jar:4.18.1:runtime
[INFO] |     |  +- (com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:compile - scope updated from runtime; omitted for duplicate)
[INFO] |     |  +- com.fasterxml.jackson.datatype:jackson-datatype-guava:jar:2.9.8:runtime
[INFO] |     |  |  +- (com.google.guava:guava:jar:18.0:runtime - omitted for conflict with 21.0)
[INFO] |     |  |  +- (com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile - scope updated from runtime; omitted for duplicate)
[INFO] |     |  |  \- (com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:runtime - omitted for duplicate)
[INFO] |     |  +- com.fasterxml.jackson.module:jackson-module-afterburner:jar:2.9.8:runtime
[INFO] |     |  |  +- (com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile - scope updated from runtime; omitted for duplicate)
[INFO] |     |  |  \- (com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:runtime - omitted for duplicate)
[INFO] |     |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.8:runtime
[INFO] |     |  |  +- (com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile - scope updated from runtime; omitted for duplicate)
[INFO] |     |  |  \- (com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:runtime - omitted for duplicate)
[INFO] |     |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.8:runtime
[INFO] |     |  |  +- (com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile - scope updated from runtime; omitted for duplicate)
[INFO] |     |  |  +- (com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile - scope updated from runtime; omitted for duplicate)
[INFO] |     |  |  \- (com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:runtime - omitted for duplicate)
[INFO] |     |  \- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.6.7:runtime
[INFO] |     |     \- (com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile - scope updated from runtime; omitted for duplicate)
[INFO] |     \- one.util:streamex:jar:0.6.8:runtime
[INFO] +- com.scireum:sirius-kernel:test-jar:tests:14.0:test
[INFO] |  +- (com.typesafe:config:jar:1.3.4:test - omitted for duplicate)
[INFO] |  +- (com.google.guava:guava:jar:21.0:test - omitted for duplicate)
[INFO] |  +- (log4j:log4j:jar:1.2.17:test - omitted for duplicate)
[INFO] |  +- (com.google.code.findbugs:jsr305:jar:3.0.2:test - omitted for duplicate)
[INFO] |  +- (org.slf4j:slf4j-log4j12:jar:1.7.28:test - omitted for duplicate)
[INFO] |  \- (com.palantir.docker.compose:docker-compose-rule-core:jar:1.3.0:test - omitted for duplicate)
[INFO] +- com.amazonaws:aws-java-sdk-s3:jar:1.11.646:test
[INFO] |  +- com.amazonaws:aws-java-sdk-kms:jar:1.11.646:test
[INFO] |  |  +- (com.amazonaws:aws-java-sdk-core:jar:1.11.646:test - omitted for duplicate)
[INFO] |  |  \- (com.amazonaws:jmespath-java:jar:1.11.646:test - omitted for duplicate)
[INFO] |  +- com.amazonaws:aws-java-sdk-core:jar:1.11.646:test
[INFO] |  |  +- commons-logging:commons-logging:jar:1.1.3:test
[INFO] |  |  +- org.apache.httpcomponents:httpclient:jar:4.5.9:test
[INFO] |  |  |  +- org.apache.httpcomponents:httpcore:jar:4.4.11:test
[INFO] |  |  |  +- (commons-logging:commons-logging:jar:1.2:test - omitted for conflict with 1.1.3)
[INFO] |  |  |  \- (commons-codec:commons-codec:jar:1.11:test - omitted for conflict with 1.12)
[INFO] |  |  +- software.amazon.ion:ion-java:jar:1.0.2:test
[INFO] |  |  +- (com.fasterxml.jackson.core:jackson-databind:jar:2.6.7.2:compile - scope updated from test; omitted for duplicate)
[INFO] |  |  +- (com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.6.7:runtime - scope updated from test; omitted for duplicate)
[INFO] |  |  \- (joda-time:joda-time:jar:2.8.1:test - omitted for conflict with 2.10.3)
[INFO] |  \- com.amazonaws:jmespath-java:jar:1.11.646:test
[INFO] |     \- (com.fasterxml.jackson.core:jackson-databind:jar:2.6.7.2:compile - scope updated from test; omitted for duplicate)
[INFO] +- junit:junit:jar:4.12:test
[INFO] |  \- (org.hamcrest:hamcrest-core:jar:1.3:compile - scope updated from test; omitted for duplicate)
[INFO] +- com.googlecode.junit-toolbox:junit-toolbox:jar:2.2:test
[INFO] |  +- (commons-io:commons-io:jar:2.4:compile - scope updated from test; omitted for duplicate)
[INFO] |  +- (junit:junit:jar:4.12:test - omitted for duplicate)
[INFO] |  +- (org.hamcrest:hamcrest-library:jar:1.3:compile - scope updated from test; omitted for duplicate)
[INFO] |  \- org.mockito:mockito-core:jar:1.9.5:test
[INFO] |     \- (org.objenesis:objenesis:jar:1.0:compile - scope updated from test; omitted for duplicate)
[INFO] +- org.spockframework:spock-core:jar:1.1-groovy-2.4:test
[INFO] |  +- org.codehaus.groovy:groovy-all:jar:2.4.9:test
[INFO] |  \- (junit:junit:jar:4.12:test - omitted for duplicate)
[INFO] +- cglib:cglib:jar:3.2.5:test
[INFO] |  +- org.ow2.asm:asm:jar:5.2:test
[INFO] |  \- org.apache.ant:ant:jar:1.9.6:test
[INFO] |     \- org.apache.ant:ant-launcher:jar:1.9.6:test
[INFO] \- org.objenesis:objenesis:jar:2.5.1:test (scope not updated to compile)
jakobvogel commented 4 years ago

Hi @Bing-ok 👋 Many thanks for getting in touch and pointing this out. I guess, in a first step, we should update the sirius-* dependencies. I can do that next week after I return from vacation. However, we should probably still unify the other dependencies further down the graph. I will ask some colleagues to have a look at your suggestions. However, feel free to submit a PR with your favorite solution.

jakobvogel commented 4 years ago

Hello! I have upgraded the sirius dependencies now. Does the problem still exist? If you still want to submit a PR, I think I would prefer the second solution.

jakobvogel commented 4 years ago

Thanks for #151 @Bing-ok 🙇‍♂️ Can we close the issue now?

Bing-ok commented 4 years ago

Sure