Skip to content

Commit 64344fb

Browse files
committed
HADOOP-17324. Don't relocate org.bouncycastle in shaded client jars (#2411)
Contributed by Chao Sun.
1 parent 0712505 commit 64344fb

File tree

6 files changed

+57
-11
lines changed

6 files changed

+57
-11
lines changed

hadoop-client-modules/hadoop-client-api/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@
143143
<exclude>org/w3c/dom/**/*</exclude>
144144
<exclude>org/xml/sax/*</exclude>
145145
<exclude>org/xml/sax/**/*</exclude>
146+
<exclude>org/bouncycastle/*</exclude>
147+
<exclude>org/bouncycastle/**/*</exclude>
146148
</excludes>
147149
</relocation>
148150
<relocation>

hadoop-client-modules/hadoop-client-check-test-invariants/src/test/resources/ensure-jars-have-correct-contents.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ allowed_expr+="|^org/apache/hadoop/"
4343
allowed_expr+="|^META-INF/"
4444
# * whatever under the "webapps" directory; for things shipped by yarn
4545
allowed_expr+="|^webapps/"
46+
# * Resources files used by Hadoop YARN mini cluster
47+
allowed_expr+="|^TERMINAL/"
4648
# * Hadoop's default configuration files, which have the form
4749
# "_module_-default.xml"
4850
allowed_expr+="|^[^-]*-default.xml$"
@@ -54,6 +56,8 @@ allowed_expr+="|^org.apache.hadoop.application-classloader.properties$"
5456
# * Used by JavaSandboxLinuxContainerRuntime as a default, loaded
5557
# from root, so can't relocate. :(
5658
allowed_expr+="|^java.policy$"
59+
# * Used by javax.annotation
60+
allowed_expr+="|^jndi.properties$"
5761
# * allowing native libraries from rocksdb. Leaving native libraries as it is.
5862
allowed_expr+="|^librocksdbjni-linux32.so"
5963
allowed_expr+="|^librocksdbjni-linux64.so"

hadoop-client-modules/hadoop-client-integration-tests/pom.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,27 @@
7575
<artifactId>hadoop-client-minicluster</artifactId>
7676
<scope>test</scope>
7777
</dependency>
78+
<dependency>
79+
<groupId>org.bouncycastle</groupId>
80+
<artifactId>bcprov-jdk15on</artifactId>
81+
<scope>test</scope>
82+
</dependency>
83+
<dependency>
84+
<groupId>org.bouncycastle</groupId>
85+
<artifactId>bcpkix-jdk15on</artifactId>
86+
<scope>test</scope>
87+
</dependency>
88+
<dependency>
89+
<groupId>javax.xml.bind</groupId>
90+
<artifactId>jaxb-api</artifactId>
91+
<scope>test</scope>
92+
</dependency>
93+
<dependency>
94+
<groupId>javax.activation</groupId>
95+
<artifactId>activation</artifactId>
96+
<version>1.1.1</version>
97+
<scope>test</scope>
98+
</dependency>
7899
</dependencies>
79100
<build>
80101
<plugins>

hadoop-client-modules/hadoop-client-integration-tests/src/test/java/org/apache/hadoop/example/ITUseMiniCluster.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.apache.hadoop.fs.FSDataInputStream;
3636
import org.apache.hadoop.fs.FSDataOutputStream;
3737
import org.apache.hadoop.fs.Path;
38+
import org.apache.hadoop.io.IOUtils;
3839

3940
import org.apache.hadoop.conf.Configuration;
4041

@@ -43,6 +44,7 @@
4344

4445
import org.apache.hadoop.hdfs.web.WebHdfsTestUtil;
4546
import org.apache.hadoop.hdfs.web.WebHdfsConstants;
47+
import org.apache.hadoop.yarn.server.MiniYARNCluster;
4648

4749
/**
4850
* Ensure that we can perform operations against the shaded minicluster
@@ -54,6 +56,7 @@ public class ITUseMiniCluster {
5456
LoggerFactory.getLogger(ITUseMiniCluster.class);
5557

5658
private MiniDFSCluster cluster;
59+
private MiniYARNCluster yarnCluster;
5760

5861
private static final String TEST_PATH = "/foo/bar/cats/dee";
5962
private static final String FILENAME = "test.file";
@@ -73,13 +76,20 @@ public void clusterUp() throws IOException {
7376
.numDataNodes(3)
7477
.build();
7578
cluster.waitActive();
79+
80+
conf.set("yarn.scheduler.capacity.root.queues", "default");
81+
conf.setInt("yarn.scheduler.capacity.root.default.capacity", 100);
82+
yarnCluster = new MiniYARNCluster(getClass().getName(), 1, 1, 1, 1);
83+
yarnCluster.init(conf);
84+
yarnCluster.start();
7685
}
7786

7887
@After
7988
public void clusterDown() {
8089
if (cluster != null) {
8190
cluster.close();
8291
}
92+
IOUtils.cleanupWithLogger(LOG, yarnCluster);
8393
}
8494

8595
@Test

hadoop-client-modules/hadoop-client-minicluster/pom.xml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -666,10 +666,8 @@
666666
<exclude>junit:junit</exclude>
667667
<exclude>com.google.code.findbugs:jsr305</exclude>
668668
<exclude>log4j:log4j</exclude>
669-
<exclude>org.eclipse.jetty.websocket:*</exclude>
670-
<exclude>javax.websocket:javax.websocket-api</exclude>
671-
<exclude>javax.annotation:javax.annotation-api</exclude>
672-
<exclude>org.eclipse.jetty:jetty-jndi</exclude>
669+
<exclude>org.eclipse.jetty.websocket:websocket-common</exclude>
670+
<exclude>org.eclipse.jetty.websocket:websocket-api</exclude>
673671
<!-- We need a filter that matches just those things that are included in the above artiacts -->
674672
<!-- Leave bouncycastle unshaded because it's signed with a special Oracle certificate so it can be a custom JCE security provider -->
675673
<exclude>org.bouncycastle:*</exclude>
@@ -719,13 +717,6 @@
719717
<exclude>testdata/*</exclude>
720718
</excludes>
721719
</filter>
722-
<!-- Skip terminal html and javascript -->
723-
<filter>
724-
<artifact>org.apache.hadoop:hadoop-yarn-server-nodemanager:*</artifact>
725-
<excludes>
726-
<exclude>TERMINAL/**/*</exclude>
727-
</excludes>
728-
</filter>
729720

730721
<!-- Mockito tries to include its own unrelocated copy of hamcrest. :( -->
731722
<filter>
@@ -772,6 +763,13 @@
772763
<exclude>about.html</exclude>
773764
</excludes>
774765
</filter>
766+
<filter>
767+
<!-- skip jetty license info already incorporated into LICENSE/NOTICE -->
768+
<artifact>org.eclipse.jetty.websocket:*</artifact>
769+
<excludes>
770+
<exclude>about.html</exclude>
771+
</excludes>
772+
</filter>
775773
<filter>
776774
<artifact>org.apache.hadoop:*</artifact>
777775
<excludes>
@@ -869,6 +867,8 @@
869867
<exclude>org/w3c/dom/**/*</exclude>
870868
<exclude>org/xml/sax/*</exclude>
871869
<exclude>org/xml/sax/**/*</exclude>
870+
<exclude>org/bouncycastle/*</exclude>
871+
<exclude>org/bouncycastle/**/*</exclude>
872872
</excludes>
873873
</relocation>
874874
<relocation>
@@ -965,6 +965,13 @@
965965
<exclude>**/pom.xml</exclude>
966966
</excludes>
967967
</relocation>
968+
<relocation>
969+
<pattern>javax/annotation/</pattern>
970+
<shadedPattern>${shaded.dependency.prefix}.javax.websocket.</shadedPattern>
971+
<excludes>
972+
<exclude>**/pom.xml</exclude>
973+
</excludes>
974+
</relocation>
968975
<relocation>
969976
<pattern>jersey/</pattern>
970977
<shadedPattern>${shaded.dependency.prefix}.jersey.</shadedPattern>

hadoop-client-modules/hadoop-client-runtime/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@
267267
<exclude>org/w3c/dom/**/*</exclude>
268268
<exclude>org/xml/sax/*</exclude>
269269
<exclude>org/xml/sax/**/*</exclude>
270+
<exclude>org/bouncycastle/*</exclude>
271+
<exclude>org/bouncycastle/**/*</exclude>
270272
</excludes>
271273
</relocation>
272274
<relocation>

0 commit comments

Comments
 (0)