Skip to content

Commit 72feffc

Browse files
[AMBARI-26142] JDK17 support for Ambari-metrics
Co-authored-by: Mohammad Arshad <arshad@apache.org>
1 parent a6324d8 commit 72feffc

File tree

13 files changed

+61
-41
lines changed

13 files changed

+61
-41
lines changed

.github/workflows/ambari.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ jobs:
2727

2828
steps:
2929
- uses: actions/checkout@v3
30-
- name: Set up JDK 8
30+
- name: Set up JDK 17
3131
uses: actions/setup-java@v3
3232
with:
33-
java-version: 8
33+
java-version: 17
3434
distribution: temurin
3535
cache: maven
3636
- name: Install Kerberos development libraries

ambari-metrics-assembly/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@
964964
<data>
965965
<src>${collector.dir}/target/lib</src>
966966
<type>directory</type>
967-
<includes>phoenix*.jar,antlr*.jar,re2j*.jar,failureaccess*.jar,guava-28*.jar,stax2-api*.jar,woodstox-core*.jar,hadoop-annotations*.jar,hadoop-auth*.jar,hadoop-common*.jar,commons-configuration2*.jar,hadoop-yarn-api-*.jar,hadoop-yarn-client-*.jar,hadoop-yarn-common-*.jar,hadoop-yarn-registry-*.jar,hadoop-yarn-server-applicationhistoryservice-*.jar,hadoop-yarn-server-common-*.jar,hadoop-yarn-server-nodemanager-*.jar,hadoop-yarn-server-resourcemanager-*.jar,hadoop-yarn-server-timelineservice-*.jar,hadoop-yarn-server-web-proxy-*.jar</includes>
967+
<includes>phoenix*.jar,antlr*.jar,re2j*.jar,failureaccess*.jar,guava-32*.jar,stax2-api*.jar,woodstox-core*.jar,hadoop-annotations*.jar,hadoop-auth*.jar,hadoop-common*.jar,commons-configuration2*.jar,hadoop-yarn-api-*.jar,hadoop-yarn-client-*.jar,hadoop-yarn-common-*.jar,hadoop-yarn-registry-*.jar,hadoop-yarn-server-applicationhistoryservice-*.jar,hadoop-yarn-server-common-*.jar,hadoop-yarn-server-nodemanager-*.jar,hadoop-yarn-server-resourcemanager-*.jar,hadoop-yarn-server-timelineservice-*.jar,hadoop-yarn-server-web-proxy-*.jar</includes>
968968
<mapper>
969969
<type>perm</type>
970970
<filemode>644</filemode>

ambari-metrics-common/pom.xml

+8-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<plugins>
3232
<plugin>
3333
<artifactId>maven-compiler-plugin</artifactId>
34-
<version>3.2</version>
34+
<version>3.5</version>
3535
</plugin>
3636
<plugin>
3737
<groupId>org.vafer</groupId>
@@ -56,7 +56,7 @@
5656
<plugin>
5757
<groupId>org.apache.maven.plugins</groupId>
5858
<artifactId>maven-shade-plugin</artifactId>
59-
<version>3.2.1</version>
59+
<version>3.5.1</version>
6060
<executions>
6161
<!-- Run shade goal on package phase -->
6262
<execution>
@@ -103,7 +103,7 @@
103103
<dependency>
104104
<groupId>com.google.guava</groupId>
105105
<artifactId>guava</artifactId>
106-
<version>28.0-jre</version>
106+
<version>32.1.3-jre</version>
107107
</dependency>
108108
<dependency>
109109
<groupId>org.apache.curator</groupId>
@@ -156,6 +156,11 @@
156156
<artifactId>httpclient</artifactId>
157157
<version>4.5.2</version>
158158
</dependency>
159+
<dependency>
160+
<groupId>javax.xml.bind</groupId>
161+
<artifactId>jaxb-api</artifactId>
162+
<version>2.2.2</version>
163+
</dependency>
159164
<dependency>
160165
<groupId>junit</groupId>
161166
<artifactId>junit</artifactId>

ambari-metrics-flume-sink/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ limitations under the License.
5454
</plugin>
5555
<plugin>
5656
<artifactId>maven-compiler-plugin</artifactId>
57-
<version>3.2</version>
57+
<version>3.5</version>
5858
</plugin>
5959
<plugin>
6060
<groupId>com.github.goldin</groupId>
@@ -141,7 +141,7 @@ limitations under the License.
141141
<dependency>
142142
<groupId>com.google.guava</groupId>
143143
<artifactId>guava</artifactId>
144-
<version>18.0</version>
144+
<version>32.1.3-jre</version>
145145
</dependency>
146146
</dependencies>
147147
</project>

ambari-metrics-hadoop-sink/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ limitations under the License.
6060
</plugin>
6161
<plugin>
6262
<artifactId>maven-compiler-plugin</artifactId>
63-
<version>3.2</version>
63+
<version>3.5</version>
6464
</plugin>
6565
<plugin>
6666
<groupId>com.github.goldin</groupId>

ambari-metrics-host-aggregator/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<dependency>
4242
<groupId>com.google.guava</groupId>
4343
<artifactId>guava</artifactId>
44-
<version>18.0</version>
44+
<version>32.1.3-jre</version>
4545
</dependency>
4646
<dependency>
4747
<groupId>org.apache.ambari</groupId>
@@ -145,7 +145,7 @@
145145
<plugin>
146146
<groupId>org.apache.maven.plugins</groupId>
147147
<artifactId>maven-shade-plugin</artifactId>
148-
<version>1.6</version>
148+
<version>3.5.1</version>
149149
<configuration>
150150
<createDependencyReducedPom>false</createDependencyReducedPom>
151151
<filters>

ambari-metrics-host-aggregator/src/test/java/org/apache/hadoop/metrics2/host/aggregator/AggregatorWebServiceTest.java

+1-5
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,14 @@
3131
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
3232
import org.junit.Test;
3333

34-
3534
import javax.ws.rs.core.MediaType;
3635

3736
import java.util.Collection;
3837
import java.util.Map;
3938

40-
import static org.junit.Assert.assertEquals;
41-
4239

4340
public class AggregatorWebServiceTest extends JerseyTest {
41+
4442
public AggregatorWebServiceTest() {
4543
super(new WebAppDescriptor.Builder(
4644
"org.apache.hadoop.metrics2.host.aggregator")
@@ -74,11 +72,9 @@ public void testWrongPath() {
7472
assertEquals(404, response.getStatus());
7573
}
7674

77-
7875
@Test
7976
public void testMetricsPost() {
8077
TimelineMetricsHolder timelineMetricsHolder = TimelineMetricsHolder.getInstance();
81-
8278
timelineMetricsHolder.extractMetricsForAggregationPublishing();
8379
timelineMetricsHolder.extractMetricsForRawPublishing();
8480

ambari-metrics-host-monitoring/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
</plugin>
5454
<plugin>
5555
<artifactId>maven-compiler-plugin</artifactId>
56-
<version>3.2</version>
56+
<version>3.5</version>
5757
</plugin>
5858
<plugin>
5959
<groupId>org.codehaus.mojo</groupId>

ambari-metrics-kafka-sink/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ limitations under the License.
7272
</plugin>
7373
<plugin>
7474
<artifactId>maven-compiler-plugin</artifactId>
75-
<version>3.2</version>
75+
<version>3.5</version>
7676
</plugin>
7777
<plugin>
7878
<groupId>com.github.goldin</groupId>

ambari-metrics-storm-sink/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ limitations under the License.
3838
<plugins>
3939
<plugin>
4040
<artifactId>maven-compiler-plugin</artifactId>
41-
<version>3.2</version>
41+
<version>3.5</version>
4242
</plugin>
4343
<plugin>
4444
<groupId>com.github.goldin</groupId>
@@ -54,7 +54,7 @@ limitations under the License.
5454
<plugin>
5555
<groupId>org.apache.maven.plugins</groupId>
5656
<artifactId>maven-shade-plugin</artifactId>
57-
<version>3.2.1</version>
57+
<version>3.5.1</version>
5858
<executions>
5959
<execution>
6060
<phase>package</phase>

ambari-metrics-timelineservice/pom.xml

+8-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
</plugin>
5858
<plugin>
5959
<artifactId>maven-compiler-plugin</artifactId>
60-
<version>3.2</version>
60+
<version>3.5</version>
6161
</plugin>
6262
<plugin>
6363
<groupId>org.codehaus.mojo</groupId>
@@ -216,7 +216,6 @@
216216
<configuration>
217217
<redirectTestOutputToFile>true</redirectTestOutputToFile>
218218
<forkMode>always</forkMode>
219-
<argLine>-XX:-UseSplitVerifier</argLine>
220219
<!-- Each profile in the top-level pom.xml defines which test group categories to run. -->
221220
<groups>${testcase.groups}</groups>
222221
</configuration>
@@ -524,7 +523,7 @@
524523
<dependency>
525524
<groupId>com.google.guava</groupId>
526525
<artifactId>guava</artifactId>
527-
<version>28.0-jre</version>
526+
<version>32.1.3-jre</version>
528527
</dependency>
529528
<dependency>
530529
<groupId>commons-logging</groupId>
@@ -664,6 +663,12 @@
664663
</exclusions>
665664
</dependency>
666665

666+
<dependency>
667+
<groupId>org.apache.hadoop</groupId>
668+
<artifactId>hadoop-yarn-server-applicationhistoryservice</artifactId>
669+
<version>${hadoop.version}</version>
670+
</dependency>
671+
667672
<!-- 'mvn dependency:analyze' fails to detect use of this dependency -->
668673
<dependency>
669674
<groupId>com.sun.jersey.jersey-test-framework</groupId>

ambari-metrics-timelineservice/src/test/java/org/apache/ambari/metrics/webapp/TestTimelineWebServices.java

+15-13
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
2626
import org.apache.ambari.metrics.core.timeline.TestTimelineMetricStore;
2727
import org.apache.ambari.metrics.core.timeline.TimelineMetricStore;
28+
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
2829
import org.apache.hadoop.yarn.webapp.GenericExceptionHandler;
2930
import org.apache.hadoop.yarn.webapp.YarnJacksonJaxbJsonProvider;
31+
3032
import org.junit.Test;
3133

3234
import com.google.inject.Guice;
@@ -75,24 +77,24 @@ protected Injector getInjector() {
7577

7678
public TestTimelineWebServices() {
7779
super(new WebAppDescriptor.Builder(
78-
"org.apache.ambari.metrics.webapp")
79-
.contextListenerClass(GuiceServletConfig.class)
80-
.filterClass(com.google.inject.servlet.GuiceFilter.class)
81-
.contextPath("jersey-guice-filter")
82-
.servletPath("/")
83-
.clientConfig(new DefaultClientConfig(YarnJacksonJaxbJsonProvider.class))
84-
.build());
80+
"org.apache.ambari.metrics.webapp")
81+
.contextListenerClass(GuiceServletConfig.class)
82+
.filterClass(com.google.inject.servlet.GuiceFilter.class)
83+
.contextPath("jersey-guice-filter")
84+
.servletPath("/")
85+
.clientConfig(new DefaultClientConfig(YarnJacksonJaxbJsonProvider.class))
86+
.build());
8587
}
8688

8789
@Test
8890
public void testAbout() throws Exception {
8991
WebResource r = resource();
9092
ClientResponse response = r.path("ws").path("v1").path("timeline")
91-
.accept(MediaType.APPLICATION_JSON)
92-
.get(ClientResponse.class);
93+
.accept(MediaType.APPLICATION_JSON)
94+
.get(ClientResponse.class);
9395
assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
9496
TimelineWebServices.AboutInfo about =
95-
response.getEntity(TimelineWebServices.AboutInfo.class);
97+
response.getEntity(TimelineWebServices.AboutInfo.class);
9698
Assert.assertNotNull(about);
9799
Assert.assertEquals("AMS API", about.getAbout());
98100
}
@@ -109,9 +111,9 @@ private static void verifyMetrics(TimelineMetrics metrics) {
109111
public void testGetMetrics() throws Exception {
110112
WebResource r = resource();
111113
ClientResponse response = r.path("ws").path("v1").path("timeline")
112-
.path("metrics").queryParam("metricNames", "cpu_user").queryParam("precision", "seconds")
113-
.accept(MediaType.APPLICATION_JSON)
114-
.get(ClientResponse.class);
114+
.path("metrics").queryParam("metricNames", "cpu_user").queryParam("precision", "seconds")
115+
.accept(MediaType.APPLICATION_JSON)
116+
.get(ClientResponse.class);
115117
assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
116118
verifyMetrics(response.getEntity(TimelineMetrics.class));
117119
}

pom.xml

+17-5
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
<distMgmtStagingUrl>https://repository.apache.org/service/local/staging/deploy/maven2</distMgmtStagingUrl>
6464
<fasterxml.jackson.version>2.10.0</fasterxml.jackson.version>
6565
<skipPythonTests>false</skipPythonTests>
66+
<jersey.version>2.41</jersey.version>
6667
<release.version>1</release.version>
6768
</properties>
6869
<distributionManagement>
@@ -133,7 +134,7 @@
133134
<dependency>
134135
<groupId>com.google.guava</groupId>
135136
<artifactId>guava</artifactId>
136-
<version>28.0-jre</version>
137+
<version>32.1.3-jre</version>
137138
</dependency>
138139
</dependencies>
139140
</dependencyManagement>
@@ -169,20 +170,31 @@
169170
<plugin>
170171
<groupId>org.apache.maven.plugins</groupId>
171172
<artifactId>maven-surefire-plugin</artifactId>
172-
<version>2.19</version>
173+
<version>3.2.5</version>
173174
<configuration>
174175
<skip>${skipSurefireTests}</skip>
176+
<argLine>
177+
--add-opens java.base/java.lang=ALL-UNNAMED
178+
--add-opens java.base/java.lang.reflect=ALL-UNNAMED
179+
--add-opens java.management/java.lang.management=ALL-UNNAMED
180+
--add-opens java.base/java.io=ALL-UNNAMED
181+
--add-opens java.base/java.nio=ALL-UNNAMED
182+
--add-opens java.base/java.util=ALL-UNNAMED
183+
--add-opens java.base/java.util.regex=ALL-UNNAMED
184+
--add-opens java.base/java.util.concurrent=ALL-UNNAMED
185+
--add-opens java.base/java.net=ALL-UNNAMED
186+
</argLine>
175187

176188
<!-- Each profile in the top-level pom.xml defines which test group categories to run. -->
177189
<groups>${testcase.groups}</groups>
178190
</configuration>
179191
</plugin>
180192
<plugin>
181193
<artifactId>maven-compiler-plugin</artifactId>
182-
<version>3.2</version>
194+
<version>3.5</version>
183195
<configuration>
184-
<source>1.8</source>
185-
<target>1.8</target>
196+
<source>17</source>
197+
<target>17</target>
186198
</configuration>
187199
</plugin>
188200
<plugin>

0 commit comments

Comments
 (0)