locationtech / geowave

GeoWave provides geospatial and temporal indexing on top of Accumulo, HBase, BigTable, Cassandra, Kudu, Redis, RocksDB, and DynamoDB.
Apache License 2.0
498 stars 190 forks source link

“NoSuchMethodErrors” due to multiple versions of com.google.guava:guava #1917

Open Bing-ok opened 9 months ago

Bing-ok commented 9 months ago

Issue description

Hi, there are multiple versions of com.google.guava:guava in geowave-1.2.0/core/geotime. As shown in the following dependency tree, according to Maven "nearest wins" strategy, only com.google.guava:guava:25.1-jre can be loaded, com.google.guava:guava:14.0-rc1 will be shadowed.

However, several methods defined in shadowed version com.google.guava:guava:14.0-rc1 are referenced by client project via org.locationtech.geowave:geowave-core-index:1.2.0 but missing in the actually loaded version com.google.guava:guava:25.1-jre.

For instance, the following missing method(defined in com.google.guava:guava:14.0-rc1) are actually referenced by GeoWave Spatial and Temporal Support, which will introduce a runtime error(i.e., "NoSuchMethodError") into GeoWave Spatial and Temporal Support.

  1. <com.google.common.collect.Interners$1: java.lang.Object intern(java.lang.Object)>
    paths--
    <org.locationtech.geowave.core.geotime.store.query.filter.SpatialQueryFilter: void fromBinary(byte[])>org.locationtech.geowave:geowave-core-geotime:1.2.0;
    <com.google.common.collect.Interners$1: java.lang.Object intern(java.lang.Object)>

Suggested fixing solutions:

  1. Use configuration to unify the version of library com.google.guava:guava to be 14.0-rc1 in the pom file.
  2. Change direct dependency com.google.guava:guava from 25.1-jre to 14.0-rc1. Because version 14.0-rc1 includes the above missing methods and is compatible with other versions of com.google.guava:guava in the project.

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

Thank you very much for your attention. Best regards,

Dependency tree --


[INFO] |  +- com.clearspring.analytics:stream:jar:2.9.6:compile
[INFO] |  |  +- it.unimi.dsi:fastutil:jar:8.1.1:compile
[INFO] |  |  \- (org.slf4j:slf4j-api:jar:1.7.21:compile - version managed from 1.7.10; omitted for duplicate)
[INFO] |  +- com.google.uzaygezen:uzaygezen-core:jar:0.2:compile
[INFO] |  |  +- org.apache.commons:commons-lang3:jar:3.4:compile (version managed from 3.1)
[INFO] |  |  +- com.google.guava:guava:jar:25.1-jre:compile (version managed from 14.0-rc1)
[INFO] |  |  |  +- (com.google.code.findbugs:jsr305:jar:3.0.2:compile - omitted for duplicate)
[INFO] |  |  |  +- org.checkerframework:checker-qual:jar:2.0.0:compile
[INFO] |  |  |  +- com.google.errorprone:error_prone_annotations:jar:2.1.3:compile
[INFO] |  |  |  +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] |  |  |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile