[HotFix] Fix NoClassDefFoundError for Guava ImmutableMap during Hive-based Iceberg catalog initialization #4069
+6
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why are the changes needed?
When initializing a Hive Metastore-based Iceberg catalog in amoro-ams, a
NoClassDefFoundError: com/google/common/collect/ImmutableMapis thrown at runtime.Hive 3.1.3's
HiveConfdirectly references the original Guava classcom.google.common.collect.ImmutableMap, but the Guava dependency inamoro-ams/pom.xmlis declared with<scope>test</scope>, so it is excluded from the runtime classpath. All other Guava artifacts in the project are shaded (e.g.,amoro-shade-guava-32,iceberg-bundled-guava,flink-shaded-guava) and do not provide classes under the originalcom.google.common.*package. Additionally, the Hive dependency explicitly excludes Guava via<exclusion>, preventing transitive resolution.This issue also affects the official distribution and Docker images.
Brief change log
<scope>test</scope>from the Guava dependency inamoro-ams/pom.xmlso that it defaults tocompilescope and is included in the runtime classpath.How was this patch tested?
NoClassDefFoundError.Documentation