Skip to content

Commit 71465f0

Browse files
committed
HADOOP-15984. Jersey 2.x upgrade
1 parent cebcb44 commit 71465f0

File tree

22 files changed

+91
-509
lines changed
  • hadoop-client-modules/hadoop-client-minicluster
  • hadoop-common-project
  • hadoop-hdfs-project
  • hadoop-mapreduce-project
  • hadoop-project
  • hadoop-tools
  • hadoop-yarn-project/hadoop-yarn
    • hadoop-yarn-applications
      • hadoop-yarn-applications-catalog/hadoop-yarn-applications-catalog-webapp
      • hadoop-yarn-services/hadoop-yarn-services-api
    • hadoop-yarn-client
    • hadoop-yarn-common
    • hadoop-yarn-server
      • hadoop-yarn-server-applicationhistoryservice
      • hadoop-yarn-server-nodemanager
      • hadoop-yarn-server-resourcemanager
      • hadoop-yarn-server-timelineservice-hbase-tests
      • hadoop-yarn-server-timelineservice
      • hadoop-yarn-server-web-proxy

22 files changed

+91
-509
lines changed

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

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -406,69 +406,6 @@
406406
<!-- skip javax.servlet:servlet-api because it's in client -->
407407
<!-- Skip commons-logging:commons-logging-api because it looks like nothing actually included it -->
408408
<!-- Skip jetty-util because it's in client -->
409-
<dependency>
410-
<groupId>com.sun.jersey</groupId>
411-
<artifactId>jersey-core</artifactId>
412-
<optional>true</optional>
413-
<exclusions>
414-
<exclusion>
415-
<groupId>javax.ws.rs</groupId>
416-
<artifactId>jsr311-api</artifactId>
417-
</exclusion>
418-
</exclusions>
419-
</dependency>
420-
<dependency>
421-
<groupId>com.sun.jersey</groupId>
422-
<artifactId>jersey-client</artifactId>
423-
<optional>true</optional>
424-
</dependency>
425-
<dependency>
426-
<groupId>com.github.pjfanning</groupId>
427-
<artifactId>jersey-json</artifactId>
428-
<optional>true</optional>
429-
<exclusions>
430-
<exclusion>
431-
<groupId>com.fasterxml.jackson.core</groupId>
432-
<artifactId>jackson-core</artifactId>
433-
</exclusion>
434-
<exclusion>
435-
<groupId>com.fasterxml.jackson.core</groupId>
436-
<artifactId>jackson-databind</artifactId>
437-
</exclusion>
438-
<exclusion>
439-
<groupId>com.fasterxml.jackson.jaxrs</groupId>
440-
<artifactId>jackson-jaxrs-json-provider</artifactId>
441-
</exclusion>
442-
<exclusion>
443-
<groupId>javax.xml.bind</groupId>
444-
<artifactId>jaxb-api</artifactId>
445-
</exclusion>
446-
</exclusions>
447-
</dependency>
448-
<dependency>
449-
<groupId>com.sun.jersey</groupId>
450-
<artifactId>jersey-server</artifactId>
451-
<optional>true</optional>
452-
</dependency>
453-
<dependency>
454-
<groupId>com.sun.jersey</groupId>
455-
<artifactId>jersey-servlet</artifactId>
456-
<optional>true</optional>
457-
<exclusions>
458-
<exclusion>
459-
<groupId>javax.servlet</groupId>
460-
<artifactId>servlet-api</artifactId>
461-
</exclusion>
462-
<exclusion>
463-
<groupId>javax.enterprise</groupId>
464-
<artifactId>cdi-api</artifactId>
465-
</exclusion>
466-
<exclusion>
467-
<groupId>ch.qos.cal10n</groupId>
468-
<artifactId>cal10n-api</artifactId>
469-
</exclusion>
470-
</exclusions>
471-
</dependency>
472409
<!-- skip org.apache.avro:avro-ipc because it doesn't look like hadoop-common actually uses it -->
473410
<dependency>
474411
<groupId>net.sf.kosmosfs</groupId>
@@ -611,24 +548,6 @@
611548
</exclusion>
612549
</exclusions>
613550
</dependency>
614-
<dependency>
615-
<groupId>com.sun.jersey.jersey-test-framework</groupId>
616-
<artifactId>jersey-test-framework-grizzly2</artifactId>
617-
<optional>true</optional>
618-
<exclusions>
619-
<!-- excluding because client already has the tomcat version -->
620-
<exclusion>
621-
<groupId>org.glassfish</groupId>
622-
<artifactId>javax.servlet</artifactId>
623-
</exclusion>
624-
</exclusions>
625-
</dependency>
626-
<!-- skipping jersey-server because it's above -->
627-
<dependency>
628-
<groupId>com.sun.jersey.contribs</groupId>
629-
<artifactId>jersey-guice</artifactId>
630-
<optional>true</optional>
631-
</dependency>
632551
<!-- skipping guice-servlet because it's above -->
633552
<!-- skipping avro because it is in client via hadoop-common -->
634553
<!-- skipping jersey-core because it's above -->

hadoop-common-project/hadoop-common/pom.xml

Lines changed: 21 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -132,49 +132,6 @@
132132
<artifactId>jsp-api</artifactId>
133133
<scope>runtime</scope>
134134
</dependency>
135-
<dependency>
136-
<groupId>com.sun.jersey</groupId>
137-
<artifactId>jersey-core</artifactId>
138-
<scope>compile</scope>
139-
</dependency>
140-
<dependency>
141-
<groupId>com.sun.jersey</groupId>
142-
<artifactId>jersey-servlet</artifactId>
143-
<scope>compile</scope>
144-
<exclusions>
145-
<exclusion>
146-
<groupId>javax.enterprise</groupId>
147-
<artifactId>cdi-api</artifactId>
148-
</exclusion>
149-
<exclusion>
150-
<groupId>javax.servlet</groupId>
151-
<artifactId>servlet-api</artifactId>
152-
</exclusion>
153-
<exclusion>
154-
<groupId>ch.qos.cal10n</groupId>
155-
<artifactId>cal10n-api</artifactId>
156-
</exclusion>
157-
</exclusions>
158-
</dependency>
159-
<dependency>
160-
<groupId>com.github.pjfanning</groupId>
161-
<artifactId>jersey-json</artifactId>
162-
<scope>compile</scope>
163-
<exclusions>
164-
<exclusion>
165-
<groupId>com.fasterxml.jackson.core</groupId>
166-
<artifactId>jackson-core</artifactId>
167-
</exclusion>
168-
<exclusion>
169-
<groupId>com.fasterxml.jackson.core</groupId>
170-
<artifactId>jackson-databind</artifactId>
171-
</exclusion>
172-
<exclusion>
173-
<groupId>com.fasterxml.jackson.jaxrs</groupId>
174-
<artifactId>jackson-jaxrs-json-provider</artifactId>
175-
</exclusion>
176-
</exclusions>
177-
</dependency>
178135
<dependency>
179136
<!--
180137
adding jettison as direct dependency (as jersey-json's jettison dependency is vulnerable with verison 1.1),
@@ -184,9 +141,28 @@
184141
<artifactId>jettison</artifactId>
185142
</dependency>
186143
<dependency>
187-
<groupId>com.sun.jersey</groupId>
144+
<groupId>javax.ws.rs</groupId>
145+
<artifactId>javax.ws.rs-api</artifactId>
146+
</dependency>
147+
<dependency>
148+
<groupId>org.glassfish.jersey.core</groupId>
149+
<artifactId>jersey-common</artifactId>
150+
</dependency>
151+
<dependency>
152+
<groupId>org.glassfish.jersey.core</groupId>
188153
<artifactId>jersey-server</artifactId>
189-
<scope>compile</scope>
154+
</dependency>
155+
<dependency>
156+
<groupId>org.glassfish.jersey.core</groupId>
157+
<artifactId>jersey-client</artifactId>
158+
</dependency>
159+
<dependency>
160+
<groupId>org.glassfish.jersey.containers</groupId>
161+
<artifactId>jersey-container-servlet-core</artifactId>
162+
</dependency>
163+
<dependency>
164+
<groupId>org.glassfish.jersey.inject</groupId>
165+
<artifactId>jersey-hk2</artifactId>
190166
</dependency>
191167
<dependency>
192168
<groupId>log4j</groupId>

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
import org.apache.hadoop.classification.VisibleForTesting;
5959
import org.apache.hadoop.util.Preconditions;
6060
import org.apache.hadoop.thirdparty.com.google.common.collect.ImmutableMap;
61-
import com.sun.jersey.spi.container.servlet.ServletContainer;
6261
import org.apache.hadoop.HadoopIllegalArgumentException;
6362
import org.apache.hadoop.classification.InterfaceAudience;
6463
import org.apache.hadoop.classification.InterfaceStability;
@@ -114,6 +113,8 @@
114113
import org.eclipse.jetty.util.ssl.SslContextFactory;
115114
import org.eclipse.jetty.util.thread.QueuedThreadPool;
116115
import org.eclipse.jetty.webapp.WebAppContext;
116+
import org.glassfish.jersey.server.ResourceConfig;
117+
import org.glassfish.jersey.servlet.ServletContainer;
117118
import org.slf4j.Logger;
118119
import org.slf4j.LoggerFactory;
119120

@@ -1022,10 +1023,24 @@ public void addJerseyResourcePackage(final String packageName,
10221023
final String pathSpec, Map<String, String> params) {
10231024
LOG.info("addJerseyResourcePackage: packageName=" + packageName
10241025
+ ", pathSpec=" + pathSpec);
1025-
final ServletHolder sh = new ServletHolder(ServletContainer.class);
1026-
sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass",
1027-
"com.sun.jersey.api.core.PackagesResourceConfig");
1028-
sh.setInitParameter("com.sun.jersey.config.property.packages", packageName);
1026+
final ResourceConfig config = new ResourceConfig().packages(packageName);
1027+
final ServletHolder sh = new ServletHolder(new ServletContainer(config));
1028+
for (Map.Entry<String, String> entry : params.entrySet()) {
1029+
sh.setInitParameter(entry.getKey(), entry.getValue());
1030+
}
1031+
webAppContext.addServlet(sh, pathSpec);
1032+
}
1033+
1034+
/**
1035+
* Add a Jersey resource config.
1036+
* @param config The Jersey ResourceConfig to be registered.
1037+
* @param pathSpec The path spec for the servlet
1038+
* @param params properties and features for ResourceConfig
1039+
*/
1040+
public void addJerseyResourceConfig(final ResourceConfig config,
1041+
final String pathSpec, Map<String, String> params) {
1042+
LOG.info("addJerseryResourceConfig: pathSpec={}", pathSpec);
1043+
final ServletHolder sh = new ServletHolder(new ServletContainer(config));
10291044
for (Map.Entry<String, String> entry : params.entrySet()) {
10301045
sh.setInitParameter(entry.getKey(), entry.getValue());
10311046
}

hadoop-common-project/hadoop-kms/pom.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@
5858
<artifactId>hadoop-shaded-guava</artifactId>
5959
<scope>compile</scope>
6060
</dependency>
61-
<dependency>
62-
<groupId>com.sun.jersey</groupId>
63-
<artifactId>jersey-core</artifactId>
64-
<scope>compile</scope>
65-
</dependency>
66-
<dependency>
67-
<groupId>com.sun.jersey</groupId>
68-
<artifactId>jersey-server</artifactId>
69-
<scope>compile</scope>
70-
</dependency>
7161
<dependency>
7262
<groupId>javax.servlet</groupId>
7363
<artifactId>javax.servlet-api</artifactId>

hadoop-hdfs-project/hadoop-hdfs-httpfs/pom.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,6 @@
5757
<artifactId>hadoop-auth</artifactId>
5858
<scope>compile</scope>
5959
</dependency>
60-
<dependency>
61-
<groupId>com.sun.jersey</groupId>
62-
<artifactId>jersey-core</artifactId>
63-
<scope>compile</scope>
64-
</dependency>
65-
<dependency>
66-
<groupId>com.sun.jersey</groupId>
67-
<artifactId>jersey-server</artifactId>
68-
<scope>compile</scope>
69-
</dependency>
7060
<dependency>
7161
<groupId>javax.servlet</groupId>
7262
<artifactId>javax.servlet-api</artifactId>

hadoop-hdfs-project/hadoop-hdfs-nfs/pom.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,6 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
108108
<artifactId>jetty-util</artifactId>
109109
<scope>compile</scope>
110110
</dependency>
111-
<dependency>
112-
<groupId>com.sun.jersey</groupId>
113-
<artifactId>jersey-core</artifactId>
114-
<scope>compile</scope>
115-
</dependency>
116-
<dependency>
117-
<groupId>com.sun.jersey</groupId>
118-
<artifactId>jersey-server</artifactId>
119-
<scope>compile</scope>
120-
</dependency>
121111
<dependency>
122112
<groupId>commons-cli</groupId>
123113
<artifactId>commons-cli</artifactId>

hadoop-hdfs-project/hadoop-hdfs/pom.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,6 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
9292
<artifactId>jetty-util-ajax</artifactId>
9393
<scope>compile</scope>
9494
</dependency>
95-
<dependency>
96-
<groupId>com.sun.jersey</groupId>
97-
<artifactId>jersey-core</artifactId>
98-
<scope>compile</scope>
99-
</dependency>
100-
<dependency>
101-
<groupId>com.sun.jersey</groupId>
102-
<artifactId>jersey-server</artifactId>
103-
<scope>compile</scope>
104-
</dependency>
10595
<dependency>
10696
<groupId>commons-cli</groupId>
10797
<artifactId>commons-cli</artifactId>

hadoop-mapreduce-project/hadoop-mapreduce-client/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,6 @@
152152
<artifactId>commons-collections</artifactId>
153153
<scope>provided</scope>
154154
</dependency>
155-
<dependency>
156-
<groupId>com.sun.jersey.jersey-test-framework</groupId>
157-
<artifactId>jersey-test-framework-grizzly2</artifactId>
158-
<scope>test</scope>
159-
</dependency>
160155
</dependencies>
161156

162157
<build>

hadoop-mapreduce-project/hadoop-mapreduce-examples/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,6 @@
9494
<type>test-jar</type>
9595
<scope>test</scope>
9696
</dependency>
97-
<dependency>
98-
<groupId>com.sun.jersey.jersey-test-framework</groupId>
99-
<artifactId>jersey-test-framework-grizzly2</artifactId>
100-
<scope>test</scope>
101-
</dependency>
10297
<dependency>
10398
<groupId>org.apache.hadoop</groupId>
10499
<artifactId>hadoop-mapreduce-client-hs</artifactId>

0 commit comments

Comments
 (0)