Skip to content

Commit b3ebd85

Browse files
committed
fix: Shade jackson libs
1 parent e3708f1 commit b3ebd85

1 file changed

Lines changed: 41 additions & 4 deletions

File tree

pom.xml

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,30 @@
5959
<spotless-maven-plugin.version>3.5.1</spotless-maven-plugin.version>
6060

6161
<kubernetes-client.version>7.7.0</kubernetes-client.version>
62+
<!--
63+
Jackson is bundled and relocated (see maven-shade-plugin), so it is decoupled from the
64+
Jackson that Hadoop ships. Keep this aligned with the version the kubernetes-client pulls in
65+
(jackson-datatype-jsr310 / jackson-dataformat-yaml) so the bundled Jackson set is consistent. -->
66+
<jackson.version>2.21.3</jackson.version>
6267
</properties>
6368

69+
<dependencyManagement>
70+
<dependencies>
71+
<!--
72+
Force every Jackson module (databind, core, annotations, jsr310, yaml) to a single
73+
version. Otherwise Maven mediation pins some modules (e.g. jackson-core) to the old
74+
version pulled in through Hadoop's (provided) dependency tree, leaving the bundled and
75+
relocated Jackson set internally inconsistent. -->
76+
<dependency>
77+
<groupId>com.fasterxml.jackson</groupId>
78+
<artifactId>jackson-bom</artifactId>
79+
<version>${jackson.version}</version>
80+
<type>pom</type>
81+
<scope>import</scope>
82+
</dependency>
83+
</dependencies>
84+
</dependencyManagement>
85+
6486
<dependencies>
6587
<dependency>
6688
<groupId>org.apache.hadoop</groupId>
@@ -80,11 +102,15 @@
80102
<version>${slf4j.version}</version>
81103
<scope>provided</scope>
82104
</dependency>
105+
<!--
106+
Bundled (not provided) and relocated via the shade plugin, see the relocations there.
107+
Pinned to the version used by the fabric8 kubernetes-client so the whole Jackson set
108+
(databind, core, annotations, jsr310, yaml) stays internally consistent, independent of
109+
whatever Jackson the target Hadoop ships. -->
83110
<dependency>
84111
<groupId>com.fasterxml.jackson.core</groupId>
85112
<artifactId>jackson-databind</artifactId>
86113
<version>${jackson.version}</version>
87-
<scope>provided</scope>
88114
</dependency>
89115
<!-- Needed by topology-provider -->
90116
<dependency>
@@ -194,6 +220,20 @@
194220
<goal>shade</goal>
195221
</goals>
196222
<phase>package</phase>
223+
<configuration>
224+
<relocations>
225+
<!--
226+
Relocate Jackson so the bundled (fabric8 kubernetes-client) Jackson is fully
227+
self-contained and does not clash with the Jackson that Hadoop ships on its
228+
classpath. Without this, the NameNode loads Hadoop's old jackson-databind
229+
(e.g. 2.12.7 on HDFS 3.4.x) while our bundled jackson-datatype-jsr310 expects a
230+
newer one, causing NoClassDefFoundError (e.g. ToEmptyObjectSerializer). -->
231+
<relocation>
232+
<pattern>com.fasterxml.jackson</pattern>
233+
<shadedPattern>tech.stackable.shaded.com.fasterxml.jackson</shadedPattern>
234+
</relocation>
235+
</relocations>
236+
</configuration>
197237
</execution>
198238
</executions>
199239
</plugin>
@@ -286,7 +326,6 @@
286326
<hadoop.version>3.4.2</hadoop.version>
287327
<!-- Taken from https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-common/3.4.2 -->
288328
<slf4j.version>1.7.36</slf4j.version>
289-
<jackson.version>2.12.7.1</jackson.version>
290329
</properties>
291330
</profile>
292331
<profile>
@@ -295,7 +334,6 @@
295334
<hadoop.version>3.4.3</hadoop.version>
296335
<!-- Taken from https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-common/3.4.3 -->
297336
<slf4j.version>1.7.36</slf4j.version>
298-
<jackson.version>2.12.7.1</jackson.version>
299337
</properties>
300338
</profile>
301339
<profile>
@@ -304,7 +342,6 @@
304342
<hadoop.version>3.5.0</hadoop.version>
305343
<!-- Taken from https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-common/3.5.0 -->
306344
<slf4j.version>1.7.36</slf4j.version>
307-
<jackson.version>2.18.6</jackson.version>
308345
</properties>
309346
</profile>
310347
</profiles>

0 commit comments

Comments
 (0)