This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 207816f2d0e HDDS-14949. Move OM gRPC to ratis-thirdparty shaded 
gRPC/Netty (#12017)
207816f2d0e is described below

commit 207816f2d0ed780b0d8f7f232454bb2d21e03f33
Author: Andrey Yarovoy <[email protected]>
AuthorDate: Fri Nov 13 01:11:17 2026 -0500

    HDDS-14949. Move OM gRPC to ratis-thirdparty shaded gRPC/Netty (#12017)
    
    Co-authored-by: Claude Opus 5.5 <[email protected]>
---
 hadoop-hdds/framework/pom.xml                      |  10 --
 .../GrpcMetricsServerRequestInterceptor.java       |  10 +-
 .../GrpcMetricsServerResponseInterceptor.java      |  10 +-
 .../metrics/GrpcMetricsServerTransportFilter.java  |   4 +-
 .../TestGrpcMetricsServerRequestInterceptor.java   |   6 +-
 hadoop-ozone/common/pom.xml                        |  59 -------
 .../ozone/om/ha/GrpcOMFailoverProxyProvider.java   |   4 +-
 .../GrpcOMFollowerReadFailoverProxyProvider.java   |   2 +-
 .../ozone/om/protocolPB/GrpcOmTransport.java       |  35 ++--
 .../grpc/ClientAddressClientInterceptor.java       |  14 +-
 .../grpc/ClientAddressServerInterceptor.java       |  12 +-
 .../om/protocolPB/grpc/GrpcClientConstants.java    |   4 +-
 .../ozone/om/protocolPB/grpc/OMGrpcError.java      |   9 +-
 .../grpc/OzoneManagerServiceGrpcBinding.java       | 176 +++++++++++++++++++++
 ...estGrpcOMFollowerReadFailoverProxyProvider.java |   4 +-
 .../ozone/om/protocolPB/GrpcTestServers.java       |  75 +++++++++
 .../TestGrpcOmTransportConcurrentFailover.java     |  56 +++----
 .../ozone/om/protocolPB/TestS3GrpcOmTransport.java | 174 +++++++-------------
 .../grpc/TestClientAddressClientInterceptor.java   |  14 +-
 .../grpc/TestClientAddressServerInterceptor.java   |  12 +-
 .../ozone/om/protocolPB/grpc/TestOMGrpcError.java  |   4 +-
 .../grpc/TestOzoneManagerServiceGrpcBinding.java   | 171 ++++++++++++++++++++
 hadoop-ozone/dist/src/main/license/bin/LICENSE.txt |  18 ---
 hadoop-ozone/dist/src/main/license/bin/NOTICE.txt  |  76 ---------
 ...rg.codehaus.mojo-animal-sniffer-annotations.txt |  21 ---
 hadoop-ozone/dist/src/main/license/jar-report.txt  |  22 ---
 hadoop-ozone/interface-client/pom.xml              |  51 ------
 hadoop-ozone/ozone-manager/pom.xml                 |  35 ----
 .../hadoop/ozone/om/GrpcOzoneManagerServer.java    |  25 ++-
 .../hadoop/ozone/om/OzoneManagerServiceGrpc.java   |  17 +-
 .../om/TestGrpcMetricsInterceptorBenchmark.java    |  10 +-
 .../ozone/om/TestGrpcOzoneManagerServer.java       |   4 +-
 .../hadoop/ozone/om/TestOMMetadataReader.java      |   2 +-
 .../request/TestOMClientRequestWithUserInfo.java   |   2 +-
 hadoop-ozone/ozonefs-shaded/pom.xml                |  78 +--------
 hadoop-ozone/s3gateway/pom.xml                     |  10 --
 pom.xml                                            |  21 +++
 37 files changed, 624 insertions(+), 633 deletions(-)

diff --git a/hadoop-hdds/framework/pom.xml b/hadoop-hdds/framework/pom.xml
index f24e0e9f40a..7595da9b680 100644
--- a/hadoop-hdds/framework/pom.xml
+++ b/hadoop-hdds/framework/pom.xml
@@ -92,16 +92,6 @@
       <groupId>io.dropwizard.metrics</groupId>
       <artifactId>metrics-core</artifactId>
     </dependency>
-    <dependency>
-      <groupId>io.grpc</groupId>
-      <artifactId>grpc-api</artifactId>
-      <exclusions>
-        <exclusion>
-          <groupId>com.google.code.findbugs</groupId>
-          <artifactId>jsr305</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
     <dependency>
       <groupId>io.opentelemetry</groupId>
       <artifactId>opentelemetry-api</artifactId>
diff --git 
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/ozone/grpc/metrics/GrpcMetricsServerRequestInterceptor.java
 
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/ozone/grpc/metrics/GrpcMetricsServerRequestInterceptor.java
index 03f17d65113..9d547c8e025 100644
--- 
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/ozone/grpc/metrics/GrpcMetricsServerRequestInterceptor.java
+++ 
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/ozone/grpc/metrics/GrpcMetricsServerRequestInterceptor.java
@@ -20,12 +20,12 @@
 import com.google.common.annotations.VisibleForTesting;
 import com.google.protobuf.AbstractMessage;
 import com.google.protobuf.Descriptors;
-import io.grpc.ForwardingServerCallListener.SimpleForwardingServerCallListener;
-import io.grpc.Metadata;
-import io.grpc.ServerCall;
-import io.grpc.ServerCallHandler;
-import io.grpc.ServerInterceptor;
 import java.util.function.LongSupplier;
+import 
org.apache.ratis.thirdparty.io.grpc.ForwardingServerCallListener.SimpleForwardingServerCallListener;
+import org.apache.ratis.thirdparty.io.grpc.Metadata;
+import org.apache.ratis.thirdparty.io.grpc.ServerCall;
+import org.apache.ratis.thirdparty.io.grpc.ServerCallHandler;
+import org.apache.ratis.thirdparty.io.grpc.ServerInterceptor;
 
 /**
  * Interceptor to gather metrics based on grpc server request.
diff --git 
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/ozone/grpc/metrics/GrpcMetricsServerResponseInterceptor.java
 
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/ozone/grpc/metrics/GrpcMetricsServerResponseInterceptor.java
index f8c8ad6027e..ba4ec4b364e 100644
--- 
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/ozone/grpc/metrics/GrpcMetricsServerResponseInterceptor.java
+++ 
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/ozone/grpc/metrics/GrpcMetricsServerResponseInterceptor.java
@@ -18,11 +18,11 @@
 package org.apache.hadoop.ozone.grpc.metrics;
 
 import com.google.protobuf.AbstractMessage;
-import io.grpc.ForwardingServerCall;
-import io.grpc.Metadata;
-import io.grpc.ServerCall;
-import io.grpc.ServerCallHandler;
-import io.grpc.ServerInterceptor;
+import org.apache.ratis.thirdparty.io.grpc.ForwardingServerCall;
+import org.apache.ratis.thirdparty.io.grpc.Metadata;
+import org.apache.ratis.thirdparty.io.grpc.ServerCall;
+import org.apache.ratis.thirdparty.io.grpc.ServerCallHandler;
+import org.apache.ratis.thirdparty.io.grpc.ServerInterceptor;
 
 /**
  * Interceptor to gather metrics based on grpc server response.
diff --git 
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/ozone/grpc/metrics/GrpcMetricsServerTransportFilter.java
 
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/ozone/grpc/metrics/GrpcMetricsServerTransportFilter.java
index 434dd9017b2..2f4fac78a58 100644
--- 
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/ozone/grpc/metrics/GrpcMetricsServerTransportFilter.java
+++ 
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/ozone/grpc/metrics/GrpcMetricsServerTransportFilter.java
@@ -17,8 +17,8 @@
 
 package org.apache.hadoop.ozone.grpc.metrics;
 
-import io.grpc.Attributes;
-import io.grpc.ServerTransportFilter;
+import org.apache.ratis.thirdparty.io.grpc.Attributes;
+import org.apache.ratis.thirdparty.io.grpc.ServerTransportFilter;
 
 /**
  * Transport filter class for tracking active client connections.
diff --git 
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/ozone/grpc/metrics/TestGrpcMetricsServerRequestInterceptor.java
 
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/ozone/grpc/metrics/TestGrpcMetricsServerRequestInterceptor.java
index c2f09e063a3..86b9d6f24e3 100644
--- 
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/ozone/grpc/metrics/TestGrpcMetricsServerRequestInterceptor.java
+++ 
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/ozone/grpc/metrics/TestGrpcMetricsServerRequestInterceptor.java
@@ -26,15 +26,15 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import io.grpc.Metadata;
-import io.grpc.ServerCall;
-import io.grpc.ServerCallHandler;
 import java.util.concurrent.atomic.AtomicLong;
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import 
org.apache.hadoop.hdds.protocol.proto.ScmBlockLocationProtocolProtos.SCMBlockLocationRequest;
 import 
org.apache.hadoop.hdds.protocol.proto.ScmBlockLocationProtocolProtos.Type;
 import 
org.apache.hadoop.hdds.protocol.proto.ScmBlockLocationProtocolProtos.UserInfo;
 import org.apache.hadoop.metrics2.lib.MetricsAnnotations;
+import org.apache.ratis.thirdparty.io.grpc.Metadata;
+import org.apache.ratis.thirdparty.io.grpc.ServerCall;
+import org.apache.ratis.thirdparty.io.grpc.ServerCallHandler;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.mockito.InOrder;
diff --git a/hadoop-ozone/common/pom.xml b/hadoop-ozone/common/pom.xml
index a6e60067b62..3b404e8458a 100644
--- a/hadoop-ozone/common/pom.xml
+++ b/hadoop-ozone/common/pom.xml
@@ -54,34 +54,6 @@
       <groupId>com.google.protobuf</groupId>
       <artifactId>protobuf-java</artifactId>
     </dependency>
-    <dependency>
-      <groupId>io.grpc</groupId>
-      <artifactId>grpc-api</artifactId>
-      <exclusions>
-        <exclusion>
-          <groupId>com.google.code.findbugs</groupId>
-          <artifactId>jsr305</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>io.grpc</groupId>
-      <artifactId>grpc-netty</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>io.grpc</groupId>
-      <artifactId>grpc-protobuf</artifactId>
-      <exclusions>
-        <exclusion>
-          <groupId>com.google.code.findbugs</groupId>
-          <artifactId>jsr305</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-handler</artifactId>
-    </dependency>
     <dependency>
       <groupId>jakarta.annotation</groupId>
       <artifactId>jakarta.annotation-api</artifactId>
@@ -134,38 +106,7 @@
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
     </dependency>
-    <dependency>
-      <!-- required by OzoneManagerServiceBlockingStub in GrpcOmTransport -->
-      <groupId>io.grpc</groupId>
-      <artifactId>grpc-stub</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-codec-http2</artifactId>
-      <scope>runtime</scope>
-    </dependency>
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-handler-proxy</artifactId>
-      <scope>runtime</scope>
-    </dependency>
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-tcnative-boringssl-static</artifactId>
-      <scope>runtime</scope>
-    </dependency>
     <!-- Test dependencies -->
-    <dependency>
-      <groupId>io.grpc</groupId>
-      <artifactId>grpc-inprocess</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>io.grpc</groupId>
-      <artifactId>grpc-testing</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.apache.ozone</groupId>
       <artifactId>hdds-test-utils</artifactId>
diff --git 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/GrpcOMFailoverProxyProvider.java
 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/GrpcOMFailoverProxyProvider.java
index 436a721c182..03ed3442b96 100644
--- 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/GrpcOMFailoverProxyProvider.java
+++ 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/GrpcOMFailoverProxyProvider.java
@@ -20,8 +20,6 @@
 import static org.apache.hadoop.hdds.HddsUtils.getHostNameFromConfigKeys;
 import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_ADDRESS_KEY;
 
-import io.grpc.Status;
-import io.grpc.StatusRuntimeException;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
@@ -38,6 +36,8 @@
 import org.apache.hadoop.ozone.om.OMConfigKeys;
 import org.apache.hadoop.ozone.om.protocolPB.GrpcOmTransport;
 import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.ratis.thirdparty.io.grpc.Status;
+import org.apache.ratis.thirdparty.io.grpc.StatusRuntimeException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/GrpcOMFollowerReadFailoverProxyProvider.java
 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/GrpcOMFollowerReadFailoverProxyProvider.java
index 8072980c476..179d7c02b77 100644
--- 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/GrpcOMFollowerReadFailoverProxyProvider.java
+++ 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/GrpcOMFollowerReadFailoverProxyProvider.java
@@ -22,7 +22,6 @@
 import static 
org.apache.hadoop.ozone.om.ha.OMFailoverProxyProviderBase.getReadException;
 import static 
org.apache.hadoop.ozone.om.ha.OMFailoverProxyProviderBase.getReadIndexException;
 
-import io.grpc.StatusRuntimeException;
 import java.io.IOException;
 import org.apache.hadoop.ozone.om.helpers.ReadConsistency;
 import org.apache.hadoop.ozone.om.protocolPB.GrpcOmTransport;
@@ -31,6 +30,7 @@
 import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse;
 import org.apache.ratis.protocol.exceptions.ReadException;
 import org.apache.ratis.protocol.exceptions.ReadIndexException;
+import org.apache.ratis.thirdparty.io.grpc.StatusRuntimeException;
 import org.apache.ratis.util.function.CheckedBiFunction;
 import org.apache.ratis.util.function.CheckedFunction;
 import org.slf4j.Logger;
diff --git 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/GrpcOmTransport.java
 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/GrpcOmTransport.java
index ae453b08f0c..f6a75195417 100644
--- 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/GrpcOmTransport.java
+++ 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/GrpcOmTransport.java
@@ -24,13 +24,6 @@
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.net.HostAndPort;
 import com.google.protobuf.ServiceException;
-import io.grpc.Context;
-import io.grpc.ManagedChannel;
-import io.grpc.Status;
-import io.grpc.StatusRuntimeException;
-import io.grpc.netty.GrpcSslContexts;
-import io.grpc.netty.NettyChannelBuilder;
-import io.netty.handler.ssl.SslContextBuilder;
 import java.io.IOException;
 import java.net.InetAddress;
 import java.security.cert.X509Certificate;
@@ -59,10 +52,18 @@
 import 
org.apache.hadoop.ozone.om.protocolPB.grpc.ClientAddressClientInterceptor;
 import org.apache.hadoop.ozone.om.protocolPB.grpc.GrpcClientConstants;
 import org.apache.hadoop.ozone.om.protocolPB.grpc.OMGrpcError;
+import 
org.apache.hadoop.ozone.om.protocolPB.grpc.OzoneManagerServiceGrpcBinding;
 import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest;
 import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse;
-import org.apache.hadoop.ozone.protocol.proto.OzoneManagerServiceGrpc;
 import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.ratis.thirdparty.io.grpc.Channel;
+import org.apache.ratis.thirdparty.io.grpc.Context;
+import org.apache.ratis.thirdparty.io.grpc.ManagedChannel;
+import org.apache.ratis.thirdparty.io.grpc.Status;
+import org.apache.ratis.thirdparty.io.grpc.StatusRuntimeException;
+import org.apache.ratis.thirdparty.io.grpc.netty.GrpcSslContexts;
+import org.apache.ratis.thirdparty.io.grpc.netty.NettyChannelBuilder;
+import org.apache.ratis.thirdparty.io.netty.handler.ssl.SslContextBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -81,8 +82,7 @@ public class GrpcOmTransport implements OmTransport {
   // gRPC specific
   private static List<X509Certificate> caCerts = null;
 
-  private final Map<String,
-      OzoneManagerServiceGrpc.OzoneManagerServiceBlockingStub> clients;
+  private final Map<String, Channel> clients;
   private final Map<String, ManagedChannel> channels;
   private final ConfigurationSource conf;
 
@@ -180,9 +180,7 @@ public void start() throws IOException {
       channels.put(hostaddr,
           channelBuilder.intercept(new ClientAddressClientInterceptor())
               .build());
-      clients.put(hostaddr,
-          OzoneManagerServiceGrpc
-              .newBlockingStub(channels.get(hostaddr)));
+      clients.put(hostaddr, channels.get(hostaddr));
     }
     int maxFailovers = conf.getInt(
         OzoneConfigKeys.OZONE_CLIENT_FAILOVER_MAX_ATTEMPTS_KEY,
@@ -237,8 +235,7 @@ private OMResponse submitRequestToHost(OMRequest payload, 
String targetHost)
             inetAddress.getHostAddress())
         .withValue(GrpcClientConstants.CLIENT_HOSTNAME_CTX_KEY,
             inetAddress.getHostName())
-        .run(() -> resp.set(clients.get(targetHost)
-            .submitRequest(payload)));
+        .run(() -> 
resp.set(OzoneManagerServiceGrpcBinding.submitRequest(clients.get(targetHost), 
payload)));
     return resp.get();
   }
 
@@ -371,9 +368,7 @@ public void startClient(ManagedChannel testChannel) throws 
IOException {
     for (String nodeId : omFailoverProxyProvider.getOMProxyMap().getNodeIds()) 
{
       String hostaddr = omFailoverProxyProvider.getGrpcProxyAddress(nodeId);
 
-      clients.put(hostaddr,
-          OzoneManagerServiceGrpc
-              .newBlockingStub(testChannel));
+      clients.put(hostaddr, testChannel);
     }
     LOG.info("{}: started", CLIENT_NAME);
   }
@@ -381,9 +376,7 @@ public void startClient(ManagedChannel testChannel) throws 
IOException {
   @VisibleForTesting
   public void startClient(String nodeId, ManagedChannel testChannel) throws 
IOException {
     String hostaddr = omFailoverProxyProvider.getGrpcProxyAddress(nodeId);
-    clients.put(hostaddr,
-        OzoneManagerServiceGrpc
-            .newBlockingStub(testChannel));
+    clients.put(hostaddr, testChannel);
     LOG.info("{}: started test client for {}", CLIENT_NAME, nodeId);
   }
 
diff --git 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/ClientAddressClientInterceptor.java
 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/ClientAddressClientInterceptor.java
index 85190d0b93f..1ba921af04d 100644
--- 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/ClientAddressClientInterceptor.java
+++ 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/ClientAddressClientInterceptor.java
@@ -17,13 +17,13 @@
 
 package org.apache.hadoop.ozone.om.protocolPB.grpc;
 
-import io.grpc.CallOptions;
-import io.grpc.Channel;
-import io.grpc.ClientCall;
-import io.grpc.ClientInterceptor;
-import io.grpc.ForwardingClientCall;
-import io.grpc.Metadata;
-import io.grpc.MethodDescriptor;
+import org.apache.ratis.thirdparty.io.grpc.CallOptions;
+import org.apache.ratis.thirdparty.io.grpc.Channel;
+import org.apache.ratis.thirdparty.io.grpc.ClientCall;
+import org.apache.ratis.thirdparty.io.grpc.ClientInterceptor;
+import org.apache.ratis.thirdparty.io.grpc.ForwardingClientCall;
+import org.apache.ratis.thirdparty.io.grpc.Metadata;
+import org.apache.ratis.thirdparty.io.grpc.MethodDescriptor;
 
 /**
  * GRPC client side interceptor to provide client hostname and IP address.
diff --git 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/ClientAddressServerInterceptor.java
 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/ClientAddressServerInterceptor.java
index f51eb2b6dc9..753fe9ff8ea 100644
--- 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/ClientAddressServerInterceptor.java
+++ 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/ClientAddressServerInterceptor.java
@@ -17,12 +17,12 @@
 
 package org.apache.hadoop.ozone.om.protocolPB.grpc;
 
-import io.grpc.Context;
-import io.grpc.Contexts;
-import io.grpc.Metadata;
-import io.grpc.ServerCall;
-import io.grpc.ServerCallHandler;
-import io.grpc.ServerInterceptor;
+import org.apache.ratis.thirdparty.io.grpc.Context;
+import org.apache.ratis.thirdparty.io.grpc.Contexts;
+import org.apache.ratis.thirdparty.io.grpc.Metadata;
+import org.apache.ratis.thirdparty.io.grpc.ServerCall;
+import org.apache.ratis.thirdparty.io.grpc.ServerCallHandler;
+import org.apache.ratis.thirdparty.io.grpc.ServerInterceptor;
 
 /**
  * GRPC server side interceptor to retrieve the client IP and hostname.
diff --git 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/GrpcClientConstants.java
 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/GrpcClientConstants.java
index e59ec98ec78..fd5331b2d8e 100644
--- 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/GrpcClientConstants.java
+++ 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/GrpcClientConstants.java
@@ -17,8 +17,8 @@
 
 package org.apache.hadoop.ozone.om.protocolPB.grpc;
 
-import io.grpc.Context;
-import io.grpc.Metadata;
+import org.apache.ratis.thirdparty.io.grpc.Context;
+import org.apache.ratis.thirdparty.io.grpc.Metadata;
 
 /**
  * Constants to store grpc-client specific header values.
diff --git 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/OMGrpcError.java
 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/OMGrpcError.java
index 9358d2ad67a..9c98fe160b1 100644
--- 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/OMGrpcError.java
+++ 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/OMGrpcError.java
@@ -17,10 +17,6 @@
 
 package org.apache.hadoop.ozone.om.protocolPB.grpc;
 
-import io.grpc.Metadata;
-import io.grpc.Status;
-import io.grpc.StatusRuntimeException;
-import io.grpc.protobuf.ProtoUtils;
 import java.io.IOException;
 import org.apache.hadoop.ozone.om.exceptions.OMException;
 import org.apache.hadoop.ozone.om.exceptions.OMLeaderNotReadyException;
@@ -28,13 +24,16 @@
 import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMGrpcErrorProto;
 import org.apache.ratis.protocol.exceptions.ReadException;
 import org.apache.ratis.protocol.exceptions.ReadIndexException;
+import org.apache.ratis.thirdparty.io.grpc.Metadata;
+import org.apache.ratis.thirdparty.io.grpc.Status;
+import org.apache.ratis.thirdparty.io.grpc.StatusRuntimeException;
 
 /**
  * The Java form of {@link OMGrpcErrorProto}, the error that the OM gRPC 
server sends in the gRPC trailers.
  */
 public final class OMGrpcError {
   private static final Metadata.Key<OMGrpcErrorProto> ERROR_KEY = 
Metadata.Key.of("om-grpc-error-bin",
-      ProtoUtils.metadataMarshaller(OMGrpcErrorProto.getDefaultInstance()));
+      
OzoneManagerServiceGrpcBinding.metadataMarshaller(OMGrpcErrorProto.parser()));
 
   private final Kind kind;
   private final String message;
diff --git 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/OzoneManagerServiceGrpcBinding.java
 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/OzoneManagerServiceGrpcBinding.java
new file mode 100644
index 00000000000..eb53e8fa976
--- /dev/null
+++ 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/OzoneManagerServiceGrpcBinding.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.om.protocolPB.grpc;
+
+import com.google.protobuf.InvalidProtocolBufferException;
+import com.google.protobuf.MessageLite;
+import com.google.protobuf.Parser;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest;
+import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse;
+import org.apache.ratis.thirdparty.io.grpc.CallOptions;
+import org.apache.ratis.thirdparty.io.grpc.Channel;
+import org.apache.ratis.thirdparty.io.grpc.Drainable;
+import org.apache.ratis.thirdparty.io.grpc.KnownLength;
+import org.apache.ratis.thirdparty.io.grpc.Metadata;
+import org.apache.ratis.thirdparty.io.grpc.MethodDescriptor;
+import org.apache.ratis.thirdparty.io.grpc.ServerServiceDefinition;
+import org.apache.ratis.thirdparty.io.grpc.ServiceDescriptor;
+import org.apache.ratis.thirdparty.io.grpc.Status;
+import org.apache.ratis.thirdparty.io.grpc.stub.ClientCalls;
+import org.apache.ratis.thirdparty.io.grpc.stub.ServerCalls;
+
+/**
+ * The gRPC binding of the OM service used by the S3 gateway, on Ratis's 
shaded gRPC.
+ * <p>
+ * {@link OMRequest} and {@link OMResponse} are unshaded protobuf messages, 
which the shaded {@code ProtoUtils}
+ * marshallers don't accept, so this class takes the place of the stub that 
protoc-gen-grpc-java generated. The service
+ * and method names, and the bytes on the wire, are the same as with the 
generated stub, so old and new clients and
+ * servers interoperate.
+ */
+public final class OzoneManagerServiceGrpcBinding {
+
+  public static final String SERVICE_NAME = "hadoop.ozone.OzoneManagerService";
+
+  private static final MethodDescriptor<OMRequest, OMResponse> 
SUBMIT_REQUEST_METHOD =
+      MethodDescriptor.<OMRequest, OMResponse>newBuilder()
+          .setType(MethodDescriptor.MethodType.UNARY)
+          
.setFullMethodName(MethodDescriptor.generateFullMethodName(SERVICE_NAME, 
"submitRequest"))
+          .setSampledToLocalTracing(true)
+          .setRequestMarshaller(marshaller(OMRequest.parser()))
+          .setResponseMarshaller(marshaller(OMResponse.parser()))
+          .build();
+
+  private static final ServiceDescriptor SERVICE_DESCRIPTOR =
+      
ServiceDescriptor.newBuilder(SERVICE_NAME).addMethod(SUBMIT_REQUEST_METHOD).build();
+
+  private OzoneManagerServiceGrpcBinding() {
+  }
+
+  public static MethodDescriptor<OMRequest, OMResponse> 
getSubmitRequestMethod() {
+    return SUBMIT_REQUEST_METHOD;
+  }
+
+  /** The server side: the service definition that calls {@code submitRequest} 
for every request. */
+  public static ServerServiceDefinition 
bindService(ServerCalls.UnaryMethod<OMRequest, OMResponse> submitRequest) {
+    return ServerServiceDefinition.builder(SERVICE_DESCRIPTOR)
+        .addMethod(SUBMIT_REQUEST_METHOD, 
ServerCalls.asyncUnaryCall(submitRequest))
+        .build();
+  }
+
+  /** The client side: a blocking call, as the generated blocking stub made 
it. */
+  public static OMResponse submitRequest(Channel channel, OMRequest request) {
+    return ClientCalls.blockingUnaryCall(channel, SUBMIT_REQUEST_METHOD, 
CallOptions.DEFAULT, request);
+  }
+
+  /** A marshaller for unshaded protobuf messages, writing the same bytes as 
{@code ProtoUtils.marshaller}. */
+  static <T extends MessageLite> MethodDescriptor.Marshaller<T> 
marshaller(Parser<T> parser) {
+    return new MethodDescriptor.Marshaller<T>() {
+      @Override
+      public InputStream stream(T message) {
+        return new MessageInputStream(message);
+      }
+
+      @Override
+      public T parse(InputStream stream) {
+        try {
+          return parser.parseFrom(stream);
+        } catch (InvalidProtocolBufferException e) {
+          throw Status.INTERNAL.withDescription("Invalid protobuf byte 
sequence").withCause(e).asRuntimeException();
+        }
+      }
+    };
+  }
+
+  /** A metadata marshaller for unshaded protobuf messages, as {@code 
ProtoUtils.metadataMarshaller}. */
+  static <T extends MessageLite> Metadata.BinaryMarshaller<T> 
metadataMarshaller(Parser<T> parser) {
+    return new Metadata.BinaryMarshaller<T>() {
+      @Override
+      public byte[] toBytes(T value) {
+        return value.toByteArray();
+      }
+
+      @Override
+      public T parseBytes(byte[] serialized) {
+        try {
+          return parser.parseFrom(serialized);
+        } catch (InvalidProtocolBufferException e) {
+          throw new IllegalArgumentException(e);
+        }
+      }
+    };
+  }
+
+  /**
+   * Serializes the message lazily. gRPC drains it straight into its frame 
({@link Drainable}), sized by
+   * {@link #available()} ({@link KnownLength}), so the common path makes no 
intermediate copy.
+   */
+  private static final class MessageInputStream extends InputStream implements 
Drainable, KnownLength {
+    private MessageLite message;
+    private ByteArrayInputStream serialized;
+
+    MessageInputStream(MessageLite message) {
+      this.message = message;
+    }
+
+    @Override
+    public int drainTo(OutputStream target) throws IOException {
+      int written = 0;
+      if (message != null) {
+        written = message.getSerializedSize();
+        message.writeTo(target);
+        message = null;
+      } else if (serialized != null) {
+        byte[] rest = new byte[serialized.available()];
+        written = serialized.read(rest, 0, rest.length);
+        target.write(rest, 0, Math.max(written, 0));
+        serialized = null;
+      }
+      return Math.max(written, 0);
+    }
+
+    @Override
+    public int read() {
+      return toByteStream() == null ? -1 : serialized.read();
+    }
+
+    @Override
+    public int read(byte[] b, int off, int len) {
+      return toByteStream() == null ? -1 : serialized.read(b, off, len);
+    }
+
+    @Override
+    public int available() {
+      if (message != null) {
+        return message.getSerializedSize();
+      }
+      return serialized == null ? 0 : serialized.available();
+    }
+
+    private ByteArrayInputStream toByteStream() {
+      if (message != null) {
+        serialized = new ByteArrayInputStream(message.toByteArray());
+        message = null;
+      }
+      return serialized;
+    }
+  }
+}
diff --git 
a/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/ha/TestGrpcOMFollowerReadFailoverProxyProvider.java
 
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/ha/TestGrpcOMFollowerReadFailoverProxyProvider.java
index 390c348bfbf..ef74553a8f0 100644
--- 
a/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/ha/TestGrpcOMFollowerReadFailoverProxyProvider.java
+++ 
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/ha/TestGrpcOMFollowerReadFailoverProxyProvider.java
@@ -26,8 +26,6 @@
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import io.grpc.Status;
-import io.grpc.StatusRuntimeException;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -48,6 +46,8 @@
 import org.apache.ratis.protocol.RaftPeerId;
 import org.apache.ratis.protocol.exceptions.ReadException;
 import org.apache.ratis.protocol.exceptions.ReadIndexException;
+import org.apache.ratis.thirdparty.io.grpc.Status;
+import org.apache.ratis.thirdparty.io.grpc.StatusRuntimeException;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
diff --git 
a/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/GrpcTestServers.java
 
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/GrpcTestServers.java
new file mode 100644
index 00000000000..06f4a7f200f
--- /dev/null
+++ 
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/GrpcTestServers.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.om.protocolPB;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import 
org.apache.hadoop.ozone.om.protocolPB.grpc.OzoneManagerServiceGrpcBinding;
+import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest;
+import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse;
+import org.apache.ratis.thirdparty.io.grpc.ManagedChannel;
+import org.apache.ratis.thirdparty.io.grpc.Server;
+import org.apache.ratis.thirdparty.io.grpc.netty.NettyChannelBuilder;
+import org.apache.ratis.thirdparty.io.grpc.netty.NettyServerBuilder;
+import org.apache.ratis.thirdparty.io.grpc.stub.ServerCalls;
+
+/**
+ * OM gRPC test servers on localhost ephemeral ports, and plaintext channels 
to them; {@link #close()} shuts all down.
+ * Ratis's shaded gRPC has no in-process transport, so tests use real loopback 
connections.
+ */
+final class GrpcTestServers implements AutoCloseable {
+  private final List<Server> servers = new ArrayList<>();
+  private final List<ManagedChannel> channels = new ArrayList<>();
+
+  /** Starts a server for {@code handler} and returns its port. */
+  int start(ServerCalls.UnaryMethod<OMRequest, OMResponse> handler) throws 
IOException {
+    Server server = NettyServerBuilder.forAddress(new 
InetSocketAddress("localhost", 0))
+        .directExecutor()
+        .addService(OzoneManagerServiceGrpcBinding.bindService(handler))
+        .build()
+        .start();
+    servers.add(server);
+    return server.getPort();
+  }
+
+  /** Starts a server for {@code handler} and returns a channel to it. */
+  ManagedChannel startAndConnect(ServerCalls.UnaryMethod<OMRequest, 
OMResponse> handler) throws IOException {
+    return connect(NettyChannelBuilder.forAddress("localhost", 
start(handler)));
+  }
+
+  ManagedChannel connect(NettyChannelBuilder builder) {
+    ManagedChannel channel = builder.usePlaintext().directExecutor().build();
+    channels.add(channel);
+    return channel;
+  }
+
+  @Override
+  public void close() throws InterruptedException {
+    for (ManagedChannel channel : channels) {
+      channel.shutdownNow().awaitTermination(5, TimeUnit.SECONDS);
+    }
+    for (Server server : servers) {
+      server.shutdownNow().awaitTermination(5, TimeUnit.SECONDS);
+    }
+    channels.clear();
+    servers.clear();
+  }
+}
diff --git 
a/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/TestGrpcOmTransportConcurrentFailover.java
 
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/TestGrpcOmTransportConcurrentFailover.java
index ca0ec669a13..223ec5a62b5 100644
--- 
a/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/TestGrpcOmTransportConcurrentFailover.java
+++ 
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/TestGrpcOmTransportConcurrentFailover.java
@@ -23,12 +23,7 @@
 import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_SERVICE_IDS_KEY;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.mockito.AdditionalAnswers.delegatesTo;
-import static org.mockito.Mockito.mock;
 
-import io.grpc.Server;
-import io.grpc.ServerBuilder;
-import io.grpc.stub.StreamObserver;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
@@ -45,11 +40,14 @@
 import org.apache.hadoop.ozone.ha.ConfUtils;
 import org.apache.hadoop.ozone.om.exceptions.OMNotLeaderException;
 import org.apache.hadoop.ozone.om.protocolPB.grpc.OMGrpcError;
+import 
org.apache.hadoop.ozone.om.protocolPB.grpc.OzoneManagerServiceGrpcBinding;
 import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest;
 import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse;
 import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type;
-import org.apache.hadoop.ozone.protocol.proto.OzoneManagerServiceGrpc;
 import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.ratis.thirdparty.io.grpc.Server;
+import org.apache.ratis.thirdparty.io.grpc.ServerBuilder;
+import org.apache.ratis.thirdparty.io.grpc.stub.StreamObserver;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -237,30 +235,6 @@ private static class MockOMServer {
     private final AtomicInteger successCount = new AtomicInteger(0);
     private final AtomicInteger failureCount = new AtomicInteger(0);
     private final AtomicBoolean isLeader = new AtomicBoolean(false);
-    private final OzoneManagerServiceGrpc.OzoneManagerServiceImplBase 
serviceImpl =
-        mock(OzoneManagerServiceGrpc.OzoneManagerServiceImplBase.class,
-            delegatesTo(new 
OzoneManagerServiceGrpc.OzoneManagerServiceImplBase() {
-              @Override
-              public void submitRequest(OMRequest request, 
StreamObserver<OMResponse> responseObserver) {
-                requestCount.incrementAndGet();
-
-                if (!isLeader.get()) {
-                  failureCount.incrementAndGet();
-                  
responseObserver.onError(OMGrpcError.toStatusRuntimeException(
-                      new OMNotLeaderException("OM:" + nodeId + " is not the 
leader. Suggested leader: om2")));
-                } else {
-                  successCount.incrementAndGet();
-                  OMResponse response = OMResponse.newBuilder()
-                      .setCmdType(request.getCmdType())
-                      
.setStatus(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status.OK)
-                      .setMessage("Success from " + nodeId)
-                      .build();
-
-                  responseObserver.onNext(response);
-                  responseObserver.onCompleted();
-                }
-              }
-            }));
     private Server server;
 
     MockOMServer(String nodeId, int port) {
@@ -270,11 +244,31 @@ public void submitRequest(OMRequest request, 
StreamObserver<OMResponse> response
 
     public void start() throws Exception {
       server = ServerBuilder.forPort(port)
-          .addService(serviceImpl)
+          
.addService(OzoneManagerServiceGrpcBinding.bindService(this::submitRequest))
           .build()
           .start();
     }
 
+    private void submitRequest(OMRequest request, StreamObserver<OMResponse> 
responseObserver) {
+      requestCount.incrementAndGet();
+
+      if (!isLeader.get()) {
+        failureCount.incrementAndGet();
+        responseObserver.onError(OMGrpcError.toStatusRuntimeException(
+            new OMNotLeaderException("OM:" + nodeId + " is not the leader. 
Suggested leader: om2")));
+      } else {
+        successCount.incrementAndGet();
+        OMResponse response = OMResponse.newBuilder()
+            .setCmdType(request.getCmdType())
+            
.setStatus(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status.OK)
+            .setMessage("Success from " + nodeId)
+            .build();
+
+        responseObserver.onNext(response);
+        responseObserver.onCompleted();
+      }
+    }
+
     public void stop() throws Exception {
       if (server != null) {
         server.shutdown();
diff --git 
a/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/TestS3GrpcOmTransport.java
 
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/TestS3GrpcOmTransport.java
index fda263e1057..5242ff88400 100644
--- 
a/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/TestS3GrpcOmTransport.java
+++ 
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/TestS3GrpcOmTransport.java
@@ -26,15 +26,8 @@
 import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_SERVICE_IDS_KEY;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.mockito.AdditionalAnswers.delegatesTo;
-import static org.mockito.Mockito.mock;
 
 import com.google.protobuf.ServiceException;
-import io.grpc.ManagedChannel;
-import io.grpc.inprocess.InProcessChannelBuilder;
-import io.grpc.inprocess.InProcessServerBuilder;
-import io.grpc.stub.StreamObserver;
-import io.grpc.testing.GrpcCleanupRule;
 import java.io.IOException;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -53,9 +46,12 @@
 import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.S3Authentication;
 import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ServiceListRequest;
 import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type;
-import org.apache.hadoop.ozone.protocol.proto.OzoneManagerServiceGrpc;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.ratis.protocol.RaftPeerId;
+import org.apache.ratis.thirdparty.io.grpc.ManagedChannel;
+import org.apache.ratis.thirdparty.io.grpc.netty.NettyChannelBuilder;
+import org.apache.ratis.thirdparty.io.grpc.stub.ServerCalls;
+import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
@@ -65,7 +61,7 @@
  * Tests for GrpcOmTransport client.
  */
 public class TestS3GrpcOmTransport {
-  private final GrpcCleanupRule grpcCleanup = new GrpcCleanupRule();
+  private final GrpcTestServers grpcServers = new GrpcTestServers();
 
   private static final Logger LOG =
       LoggerFactory.getLogger(TestS3GrpcOmTransport.class);
@@ -90,38 +86,24 @@ public class TestS3GrpcOmTransport {
   private UserGroupInformation ugi;
   private ManagedChannel channel;
 
-  private String serverName;
-
-  private final OzoneManagerServiceGrpc.OzoneManagerServiceImplBase
-      serviceImpl =
-      mock(OzoneManagerServiceGrpc.OzoneManagerServiceImplBase.class,
-          delegatesTo(
-              new OzoneManagerServiceGrpc.OzoneManagerServiceImplBase() {
-                @Override
-                public void 
submitRequest(org.apache.hadoop.ozone.protocol.proto
-                                              .OzoneManagerProtocolProtos
-                                              .OMRequest request,
-                                          
io.grpc.stub.StreamObserver<org.apache
-                                              .hadoop.ozone.protocol.proto
-                                              .OzoneManagerProtocolProtos
-                                              .OMResponse>
-                                              responseObserver) {
-                  try {
-                    if (doFailover) {
-                      if (completeFailover) {
-                        doFailover = false;
-                      }
-                      failoverCount++;
-                      throw createNotLeaderException();
-                    } else {
-                      responseObserver.onNext(omResponse);
-                      responseObserver.onCompleted();
-                    }
-                  } catch (Throwable e) {
-                    
responseObserver.onError(OMGrpcError.toStatusRuntimeException(e.getCause()));
-                  }
-                }
-              }));
+  private int serverPort;
+
+  private final ServerCalls.UnaryMethod<OMRequest, OMResponse> serviceImpl = 
(request, responseObserver) -> {
+    try {
+      if (doFailover) {
+        if (completeFailover) {
+          doFailover = false;
+        }
+        failoverCount++;
+        throw createNotLeaderException();
+      } else {
+        responseObserver.onNext(omResponse);
+        responseObserver.onCompleted();
+      }
+    } catch (Throwable e) {
+      
responseObserver.onError(OMGrpcError.toStatusRuntimeException(e.getCause()));
+    }
+  };
 
   private GrpcOmTransport client;
 
@@ -137,21 +119,8 @@ private ServiceException createNotLeaderException() {
   @BeforeEach
   public void setUp() throws Exception {
     failoverCount = 0;
-    // Generate a unique in-process server name.
-    serverName = InProcessServerBuilder.generateName();
-
-    // Create a server, add service, start,
-    // and register for automatic graceful shutdown.
-    grpcCleanup.register(InProcessServerBuilder
-        .forName(serverName)
-        .directExecutor()
-        .addService(serviceImpl)
-        .build()
-        .start());
-
-    // Create a client channel and register for automatic graceful shutdown.
-    channel = grpcCleanup.register(
-        InProcessChannelBuilder.forName(serverName).directExecutor().build());
+    serverPort = grpcServers.start(serviceImpl);
+    channel = grpcServers.connect(NettyChannelBuilder.forAddress("localhost", 
serverPort));
 
     omServiceId = "";
     conf = new OzoneConfiguration();
@@ -159,6 +128,11 @@ public void setUp() throws Exception {
     doFailover = false;
   }
 
+  @AfterEach
+  public void tearDown() throws InterruptedException {
+    grpcServers.close();
+  }
+
   @Test
   public void testSubmitRequestToServer() throws Exception {
     ServiceListRequest req = ServiceListRequest.newBuilder().build();
@@ -266,19 +240,16 @@ public void testGrpcFailoverExceedMaxMesgLen() throws 
Exception {
     client = new GrpcOmTransport(conf, ugi, omServiceId);
     int maxSize = conf.getInt(OZONE_OM_GRPC_MAXIMUM_RESPONSE_LENGTH,
         OZONE_OM_GRPC_MAXIMUM_RESPONSE_LENGTH_DEFAULT);
-    channel = grpcCleanup.register(
-        InProcessChannelBuilder
-            .forName(serverName)
-            .maxInboundMetadataSize(maxSize)
-            .directExecutor().build());
+    channel = grpcServers.connect(NettyChannelBuilder.forAddress("localhost", 
serverPort)
+        .maxInboundMessageSize(maxSize));
     client.startClient(channel);
 
-    doFailover = true;
-    // GrpcOMFailoverProvider returns Fail retry due to mesg response
-    // len > 0, causing RESOURCE_EXHAUSTED exception.
+    // The response is longer than the 1-byte limit, causing a
+    // RESOURCE_EXHAUSTED exception from the client channel.
     // This exception should cause failover to NOT retry,
     // rather to fail.
     assertThrows(Exception.class, () -> client.submitRequest(omRequest));
+    assertEquals(0, failoverCount);
   }
 
   @Test
@@ -625,50 +596,27 @@ private void configureHaOmService(String... nodeIds) {
   private ManagedChannel createNodeChannel(String nodeId,
       AtomicInteger requestCount, AtomicReference<OMRequest> lastRequest)
       throws IOException {
-    String nodeServerName = InProcessServerBuilder.generateName();
-    grpcCleanup.register(InProcessServerBuilder
-        .forName(nodeServerName)
-        .directExecutor()
-        .addService(new OzoneManagerServiceGrpc.OzoneManagerServiceImplBase() {
-          @Override
-          public void submitRequest(OMRequest request,
-              StreamObserver<OMResponse> responseObserver) {
-            requestCount.incrementAndGet();
-            lastRequest.set(request);
-            responseObserver.onNext(newSuccessResponse(nodeId, request));
-            responseObserver.onCompleted();
-          }
-        })
-        .build()
-        .start());
-    return grpcCleanup.register(
-        
InProcessChannelBuilder.forName(nodeServerName).directExecutor().build());
+    return grpcServers.startAndConnect((request, responseObserver) -> {
+      requestCount.incrementAndGet();
+      lastRequest.set(request);
+      responseObserver.onNext(newSuccessResponse(nodeId, request));
+      responseObserver.onCompleted();
+    });
   }
 
   /** An OM leader that is not ready for its first {@code notReadyCount} 
requests. */
   private ManagedChannel createNotReadyLeaderNodeChannel(String nodeId, int 
notReadyCount,
       List<OMRequest> requests) throws IOException {
-    String nodeServerName = InProcessServerBuilder.generateName();
-    grpcCleanup.register(InProcessServerBuilder
-        .forName(nodeServerName)
-        .directExecutor()
-        .addService(new OzoneManagerServiceGrpc.OzoneManagerServiceImplBase() {
-          @Override
-          public void submitRequest(OMRequest request, 
StreamObserver<OMResponse> responseObserver) {
-            requests.add(request);
-            if (requests.size() <= notReadyCount) {
-              responseObserver.onError(OMGrpcError.toStatusRuntimeException(
-                  new OMLeaderNotReadyException(nodeId + " is not ready")));
-              return;
-            }
-            responseObserver.onNext(newSuccessResponse(nodeId, request));
-            responseObserver.onCompleted();
-          }
-        })
-        .build()
-        .start());
-    return grpcCleanup.register(
-        
InProcessChannelBuilder.forName(nodeServerName).directExecutor().build());
+    return grpcServers.startAndConnect((request, responseObserver) -> {
+      requests.add(request);
+      if (requests.size() <= notReadyCount) {
+        responseObserver.onError(OMGrpcError.toStatusRuntimeException(
+            new OMLeaderNotReadyException(nodeId + " is not ready")));
+        return;
+      }
+      responseObserver.onNext(newSuccessResponse(nodeId, request));
+      responseObserver.onCompleted();
+    });
   }
 
   private static OMResponse newSuccessResponse(String nodeId, OMRequest 
request) {
@@ -682,22 +630,10 @@ private static OMResponse newSuccessResponse(String 
nodeId, OMRequest request) {
 
   private ManagedChannel createNotLeaderNodeChannel(AtomicInteger requestCount,
       OMNotLeaderException notLeaderException) throws IOException {
-    String nodeServerName = InProcessServerBuilder.generateName();
-    grpcCleanup.register(InProcessServerBuilder
-        .forName(nodeServerName)
-        .directExecutor()
-        .addService(new OzoneManagerServiceGrpc.OzoneManagerServiceImplBase() {
-          @Override
-          public void submitRequest(OMRequest request,
-              StreamObserver<OMResponse> responseObserver) {
-            requestCount.incrementAndGet();
-            
responseObserver.onError(OMGrpcError.toStatusRuntimeException(notLeaderException));
-          }
-        })
-        .build()
-        .start());
-    return grpcCleanup.register(
-        
InProcessChannelBuilder.forName(nodeServerName).directExecutor().build());
+    return grpcServers.startAndConnect((request, responseObserver) -> {
+      requestCount.incrementAndGet();
+      
responseObserver.onError(OMGrpcError.toStatusRuntimeException(notLeaderException));
+    });
   }
 
   private static OMRequest arbitraryOmRequest() {
diff --git 
a/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/grpc/TestClientAddressClientInterceptor.java
 
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/grpc/TestClientAddressClientInterceptor.java
index eba5950c52e..ac22dc37c2d 100644
--- 
a/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/grpc/TestClientAddressClientInterceptor.java
+++ 
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/grpc/TestClientAddressClientInterceptor.java
@@ -23,13 +23,13 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import io.grpc.CallOptions;
-import io.grpc.Channel;
-import io.grpc.ClientCall;
-import io.grpc.ClientInterceptor;
-import io.grpc.Context;
-import io.grpc.Metadata;
-import io.grpc.MethodDescriptor;
+import org.apache.ratis.thirdparty.io.grpc.CallOptions;
+import org.apache.ratis.thirdparty.io.grpc.Channel;
+import org.apache.ratis.thirdparty.io.grpc.ClientCall;
+import org.apache.ratis.thirdparty.io.grpc.ClientInterceptor;
+import org.apache.ratis.thirdparty.io.grpc.Context;
+import org.apache.ratis.thirdparty.io.grpc.Metadata;
+import org.apache.ratis.thirdparty.io.grpc.MethodDescriptor;
 import org.junit.jupiter.api.Test;
 import org.mockito.MockedStatic;
 
diff --git 
a/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/grpc/TestClientAddressServerInterceptor.java
 
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/grpc/TestClientAddressServerInterceptor.java
index fba6ad21ea7..10a00bd21fd 100644
--- 
a/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/grpc/TestClientAddressServerInterceptor.java
+++ 
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/grpc/TestClientAddressServerInterceptor.java
@@ -23,12 +23,12 @@
 import static org.mockito.Mockito.mockStatic;
 import static org.mockito.Mockito.when;
 
-import io.grpc.Context;
-import io.grpc.Contexts;
-import io.grpc.Metadata;
-import io.grpc.ServerCall;
-import io.grpc.ServerCallHandler;
-import io.grpc.ServerInterceptor;
+import org.apache.ratis.thirdparty.io.grpc.Context;
+import org.apache.ratis.thirdparty.io.grpc.Contexts;
+import org.apache.ratis.thirdparty.io.grpc.Metadata;
+import org.apache.ratis.thirdparty.io.grpc.ServerCall;
+import org.apache.ratis.thirdparty.io.grpc.ServerCallHandler;
+import org.apache.ratis.thirdparty.io.grpc.ServerInterceptor;
 import org.junit.jupiter.api.Test;
 import org.mockito.ArgumentCaptor;
 import org.mockito.MockedStatic;
diff --git 
a/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/grpc/TestOMGrpcError.java
 
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/grpc/TestOMGrpcError.java
index b2f1481f920..4f10471f8b1 100644
--- 
a/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/grpc/TestOMGrpcError.java
+++ 
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/grpc/TestOMGrpcError.java
@@ -21,8 +21,6 @@
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNull;
 
-import io.grpc.Status;
-import io.grpc.StatusRuntimeException;
 import java.io.IOException;
 import org.apache.hadoop.ozone.om.exceptions.OMException;
 import org.apache.hadoop.ozone.om.exceptions.OMLeaderNotReadyException;
@@ -32,6 +30,8 @@
 import org.apache.ratis.protocol.RaftPeerId;
 import org.apache.ratis.protocol.exceptions.ReadException;
 import org.apache.ratis.protocol.exceptions.ReadIndexException;
+import org.apache.ratis.thirdparty.io.grpc.Status;
+import org.apache.ratis.thirdparty.io.grpc.StatusRuntimeException;
 import org.junit.jupiter.api.Test;
 
 /**
diff --git 
a/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/grpc/TestOzoneManagerServiceGrpcBinding.java
 
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/grpc/TestOzoneManagerServiceGrpcBinding.java
new file mode 100644
index 00000000000..d88c51ab7c7
--- /dev/null
+++ 
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/grpc/TestOzoneManagerServiceGrpcBinding.java
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.om.protocolPB.grpc;
+
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetSocketAddress;
+import java.util.concurrent.TimeUnit;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hadoop.ozone.om.exceptions.OMNotLeaderException;
+import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMGrpcErrorProto;
+import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest;
+import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse;
+import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type;
+import org.apache.ratis.thirdparty.io.grpc.Drainable;
+import org.apache.ratis.thirdparty.io.grpc.KnownLength;
+import org.apache.ratis.thirdparty.io.grpc.ManagedChannel;
+import org.apache.ratis.thirdparty.io.grpc.Metadata;
+import org.apache.ratis.thirdparty.io.grpc.MethodDescriptor;
+import org.apache.ratis.thirdparty.io.grpc.Server;
+import org.apache.ratis.thirdparty.io.grpc.StatusRuntimeException;
+import org.apache.ratis.thirdparty.io.grpc.netty.NettyChannelBuilder;
+import org.apache.ratis.thirdparty.io.grpc.netty.NettyServerBuilder;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests for {@link OzoneManagerServiceGrpcBinding}. The method name and the 
bytes on the wire must stay those of the
+ * stub that protoc-gen-grpc-java generated before HDDS-14949, so that old and 
new S3 gateways and OMs interoperate.
+ */
+public class TestOzoneManagerServiceGrpcBinding {
+  private static final int MAX_MESSAGE_SIZE = 8 * 1024 * 1024;
+
+  private static final OMRequest REQUEST = OMRequest.newBuilder()
+      
.setCmdType(Type.ListVolume).setClientId("client-1").setTraceID("trace-1").build();
+
+  private static OMResponse response(int messageLength) {
+    return 
OMResponse.newBuilder().setCmdType(Type.ListVolume).setStatus(Status.OK)
+        .setMessage(StringUtils.repeat('x', messageLength)).build();
+  }
+
+  @Test
+  public void testMethodIsTheGeneratedStubsMethod() {
+    MethodDescriptor<OMRequest, OMResponse> method = 
OzoneManagerServiceGrpcBinding.getSubmitRequestMethod();
+    // the full name of OzoneManagerServiceGrpc.getSubmitRequestMethod() in 
the generated stub
+    assertEquals("hadoop.ozone.OzoneManagerService/submitRequest", 
method.getFullMethodName());
+    assertEquals(MethodDescriptor.MethodType.UNARY, method.getType());
+  }
+
+  @Test
+  public void testMarshallerWritesTheMessageBytes() throws IOException {
+    MethodDescriptor<OMRequest, OMResponse> method = 
OzoneManagerServiceGrpcBinding.getSubmitRequestMethod();
+    OMResponse response = response(1000);
+
+    // drained, as gRPC writes a frame
+    assertArrayEquals(REQUEST.toByteArray(), 
drain(method.streamRequest(REQUEST)));
+    assertArrayEquals(response.toByteArray(), 
drain(method.streamResponse(response)));
+    // read byte by byte, and read after a partial read
+    assertArrayEquals(response.toByteArray(), 
readAll(method.streamResponse(response)));
+    InputStream partial = method.streamResponse(response);
+    byte[] first = new byte[10];
+    assertEquals(10, partial.read(first, 0, 10));
+    ByteArrayOutputStream rest = new ByteArrayOutputStream();
+    rest.write(first);
+    ((Drainable) partial).drainTo(rest);
+    assertArrayEquals(response.toByteArray(), rest.toByteArray());
+    assertEquals(-1, partial.read());
+
+    InputStream sized = method.streamResponse(response);
+    assertEquals(response.getSerializedSize(), sized.available());
+    assertEquals(response.getSerializedSize(), ((KnownLength) 
sized).available());
+  }
+
+  @Test
+  public void testMarshallerParsesWhatItWrites() {
+    MethodDescriptor<OMRequest, OMResponse> method = 
OzoneManagerServiceGrpcBinding.getSubmitRequestMethod();
+    OMResponse response = response(1000);
+    assertEquals(REQUEST, method.parseRequest(method.streamRequest(REQUEST)));
+    assertEquals(response, 
method.parseResponse(method.streamResponse(response)));
+
+    StatusRuntimeException e = assertThrows(StatusRuntimeException.class,
+        () -> method.parseRequest(new ByteArrayInputStream(new byte[] {(byte) 
0xff, (byte) 0xff})));
+    assertEquals(org.apache.ratis.thirdparty.io.grpc.Status.Code.INTERNAL, 
e.getStatus().getCode());
+  }
+
+  @Test
+  public void testMetadataMarshaller() {
+    Metadata.BinaryMarshaller<OMGrpcErrorProto> marshaller =
+        
OzoneManagerServiceGrpcBinding.metadataMarshaller(OMGrpcErrorProto.parser());
+    OMGrpcErrorProto error = OMGrpcError.fromException(new 
OMNotLeaderException("om1 is not the leader", "om2"))
+        .getProtobuf();
+    assertArrayEquals(error.toByteArray(), marshaller.toBytes(error));
+    assertEquals(error, marshaller.parseBytes(marshaller.toBytes(error)));
+    assertThrows(IllegalArgumentException.class, () -> 
marshaller.parseBytes(new byte[] {(byte) 0xff}));
+  }
+
+  @Test
+  public void testCallOverLoopback() throws Exception {
+    Server server = NettyServerBuilder.forAddress(new 
InetSocketAddress("localhost", 0))
+        .addService(OzoneManagerServiceGrpcBinding.bindService((request, 
observer) -> {
+          if (request.getClientId().equals("notleader")) {
+            observer.onError(OMGrpcError.toStatusRuntimeException(new 
OMNotLeaderException("not leader", "om2")));
+            return;
+          }
+          observer.onNext(response(Integer.parseInt(request.getClientId())));
+          observer.onCompleted();
+        }))
+        .build().start();
+    ManagedChannel channel = NettyChannelBuilder.forAddress("localhost", 
server.getPort())
+        .usePlaintext().maxInboundMessageSize(MAX_MESSAGE_SIZE).build();
+    try {
+      // just under the limit; the response carries a few bytes besides the 
message
+      int fits = MAX_MESSAGE_SIZE - 64;
+      assertEquals(fits, OzoneManagerServiceGrpcBinding.submitRequest(channel, 
request(String.valueOf(fits)))
+          .getMessage().length());
+
+      StatusRuntimeException tooLarge = 
assertThrows(StatusRuntimeException.class,
+          () -> OzoneManagerServiceGrpcBinding.submitRequest(channel, 
request(String.valueOf(MAX_MESSAGE_SIZE))));
+      
assertEquals(org.apache.ratis.thirdparty.io.grpc.Status.Code.RESOURCE_EXHAUSTED,
+          tooLarge.getStatus().getCode());
+
+      StatusRuntimeException notLeader = 
assertThrows(StatusRuntimeException.class,
+          () -> OzoneManagerServiceGrpcBinding.submitRequest(channel, 
request("notleader")));
+      OMGrpcError error = OMGrpcError.fromStatusRuntimeException(notLeader);
+      assertEquals(OMGrpcError.Kind.NOT_LEADER, error.getKind());
+      assertEquals("om2", error.getSuggestedLeaderNodeId());
+    } finally {
+      channel.shutdownNow().awaitTermination(10, TimeUnit.SECONDS);
+      server.shutdownNow().awaitTermination(10, TimeUnit.SECONDS);
+    }
+  }
+
+  private static OMRequest request(String clientId) {
+    return REQUEST.toBuilder().setClientId(clientId).build();
+  }
+
+  private static byte[] drain(InputStream stream) throws IOException {
+    ByteArrayOutputStream out = new ByteArrayOutputStream();
+    ((Drainable) stream).drainTo(out);
+    return out.toByteArray();
+  }
+
+  private static byte[] readAll(InputStream stream) throws IOException {
+    ByteArrayOutputStream out = new ByteArrayOutputStream();
+    for (int b = stream.read(); b != -1; b = stream.read()) {
+      out.write(b);
+    }
+    return out.toByteArray();
+  }
+}
diff --git a/hadoop-ozone/dist/src/main/license/bin/LICENSE.txt 
b/hadoop-ozone/dist/src/main/license/bin/LICENSE.txt
index 3f27f261067..adb097bfa2b 100644
--- a/hadoop-ozone/dist/src/main/license/bin/LICENSE.txt
+++ b/hadoop-ozone/dist/src/main/license/bin/LICENSE.txt
@@ -283,7 +283,6 @@ Apache License 2.0
    com.github.jnr:jffi
    com.github.stephenc.jcip:jcip-annotations
    com.google.android:annotations
-   com.google.api.grpc:proto-google-common-protos
    com.google.code.gson:gson
    com.google.errorprone:error_prone_annotations
    com.google.guava:failureaccess
@@ -320,26 +319,11 @@ Apache License 2.0
    info.picocli:picocli-shell-jline3
    io.airlift:aircompressor
    io.dropwizard.metrics:metrics-core
-   io.grpc:grpc-api
-   io.grpc:grpc-context
-   io.grpc:grpc-core
-   io.grpc:grpc-netty
-   io.grpc:grpc-protobuf
-   io.grpc:grpc-protobuf-lite
-   io.grpc:grpc-stub
-   io.grpc:grpc-util
    io.netty:netty-buffer
    io.netty:netty-codec
-   io.netty:netty-codec-http
-   io.netty:netty-codec-http2
-   io.netty:netty-codec-socks
    io.netty:netty-common
    io.netty:netty-handler
-   io.netty:netty-handler-proxy
    io.netty:netty-resolver
-   io.netty:netty-tcnative
-   io.netty:netty-tcnative-boringssl-static
-   io.netty:netty-tcnative-classes
    io.netty:netty-transport
    io.netty:netty-transport-classes-epoll
    io.netty:netty-transport-native-epoll
@@ -358,7 +342,6 @@ Apache License 2.0
    io.opentelemetry:opentelemetry-sdk-logs
    io.opentelemetry:opentelemetry-sdk-metrics
    io.opentelemetry:opentelemetry-sdk-trace
-   io.perfmark:perfmark-api
    io.prometheus:simpleclient
    io.prometheus:simpleclient_common
    io.prometheus:simpleclient_dropwizard
@@ -493,7 +476,6 @@ MIT
    org.bouncycastle:bcpkix-jdk18on
    org.bouncycastle:bcprov-jdk18on
    org.bouncycastle:bcutil-jdk18on
-   org.codehaus.mojo:animal-sniffer-annotations
    org.slf4j:jcl-over-slf4j
    org.slf4j:jul-to-slf4j
    org.slf4j:slf4j-api
diff --git a/hadoop-ozone/dist/src/main/license/bin/NOTICE.txt 
b/hadoop-ozone/dist/src/main/license/bin/NOTICE.txt
index dd78c02888c..4fadb100707 100644
--- a/hadoop-ozone/dist/src/main/license/bin/NOTICE.txt
+++ b/hadoop-ozone/dist/src/main/license/bin/NOTICE.txt
@@ -271,82 +271,6 @@ This product contains the Maven wrapper scripts from 
'Maven Wrapper', that provi
     * https://github.com/takari/maven-wrapper
 
 
-io.grpc:grpc-core
-====================
-
-Copyright 2014 The gRPC Authors
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
------------------------------------------------------------------------
-
-This product contains a modified portion of 'OkHttp', an open source
-HTTP & SPDY client for Android and Java applications, which can be obtained
-at:
-
-  * LICENSE:
-    * okhttp/third_party/okhttp/LICENSE (Apache License 2.0)
-  * HOMEPAGE:
-    * https://github.com/square/okhttp
-  * LOCATION_IN_GRPC:
-    * okhttp/third_party/okhttp
-
-This product contains a modified portion of 'Envoy', an open source
-cloud-native high-performance edge/middle/service proxy, which can be
-obtained at:
-
-  * LICENSE:
-    * xds/third_party/envoy/LICENSE (Apache License 2.0)
-  * NOTICE:
-    * xds/third_party/envoy/NOTICE
-  * HOMEPAGE:
-    * https://www.envoyproxy.io
-  * LOCATION_IN_GRPC:
-    * xds/third_party/envoy
-
-This product contains a modified portion of 'gogoprotobuf',
-an open source Protocol Buffers support for Go with Gadgets,
-which can be obtained at:
-
-  * LICENSE:
-    * xds/third_party/gogoproto/LICENSE
-  * HOMEPAGE:
-    * https://github.com/gogo/protobuf
-  * LOCATION_IN_GRPC:
-    * xds/third_party/gogoproto
-
-This product contains a modified portion of 'protoc-gen-validate (PGV)',
-an open source protoc plugin to generate polyglot message validators,
-which can be obtained at:
-
-  * LICENSE:
-    * xds/third_party/protoc-gen-validate/LICENSE (Apache License 2.0)
-  * HOMEPAGE:
-    * https://github.com/lyft/protoc-gen-validate
-  * LOCATION_IN_GRPC:
-    * xds/third_party/protoc-gen-validate
-
-This product contains a modified portion of 'udpa',
-an open source universal data plane API, which can be obtained at:
-
-  * LICENSE:
-    * xds/third_party/udpa/LICENSE (Apache License 2.0)
-  * HOMEPAGE:
-    * https://github.com/cncf/udpa
-  * LOCATION_IN_GRPC:
-    * xds/third_party/udpa
-
-
 com.fasterxml.jackson.dataformat:jackson-dataformat-xml
 ====================
 
diff --git 
a/hadoop-ozone/dist/src/main/license/bin/licenses/LICENSE-org.codehaus.mojo-animal-sniffer-annotations.txt
 
b/hadoop-ozone/dist/src/main/license/bin/licenses/LICENSE-org.codehaus.mojo-animal-sniffer-annotations.txt
deleted file mode 100644
index f88186cc45b..00000000000
--- 
a/hadoop-ozone/dist/src/main/license/bin/licenses/LICENSE-org.codehaus.mojo-animal-sniffer-annotations.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-  The MIT License
-
-  Copyright (c) 2009 codehaus.org.
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy
-  of this software and associated documentation files (the "Software"), to deal
-  in the Software without restriction, including without limitation the rights
-  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-  copies of the Software, and to permit persons to whom the Software is
-  furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in
-  all copies or substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-  THE SOFTWARE.
\ No newline at end of file
diff --git a/hadoop-ozone/dist/src/main/license/jar-report.txt 
b/hadoop-ozone/dist/src/main/license/jar-report.txt
index 661b9c065cf..b0ea8913455 100644
--- a/hadoop-ozone/dist/src/main/license/jar-report.txt
+++ b/hadoop-ozone/dist/src/main/license/jar-report.txt
@@ -1,5 +1,4 @@
 share/ozone/lib/aircompressor.jar
-share/ozone/lib/animal-sniffer-annotations.jar
 share/ozone/lib/annotations.jar
 share/ozone/lib/annotations.jar
 share/ozone/lib/aopalliance-repackaged.jar
@@ -42,14 +41,6 @@ share/ozone/lib/disruptor.jar
 share/ozone/lib/dnsjava.jar
 share/ozone/lib/error_prone_annotations.jar
 share/ozone/lib/failureaccess.jar
-share/ozone/lib/grpc-api.jar
-share/ozone/lib/grpc-context.jar
-share/ozone/lib/grpc-core.jar
-share/ozone/lib/grpc-netty.jar
-share/ozone/lib/grpc-protobuf-lite.jar
-share/ozone/lib/grpc-protobuf.jar
-share/ozone/lib/grpc-stub.jar
-share/ozone/lib/grpc-util.jar
 share/ozone/lib/gson.jar
 share/ozone/lib/guava-jre.jar
 share/ozone/lib/guice-assistedinject.jar
@@ -192,21 +183,10 @@ share/ozone/lib/log4j-api.jar
 share/ozone/lib/log4j-core.jar
 share/ozone/lib/metrics-core.jar
 share/ozone/lib/netty-buffer.Final.jar
-share/ozone/lib/netty-codec-http.Final.jar
-share/ozone/lib/netty-codec-http2.Final.jar
-share/ozone/lib/netty-codec-socks.Final.jar
 share/ozone/lib/netty-codec.Final.jar
 share/ozone/lib/netty-common.Final.jar
-share/ozone/lib/netty-handler-proxy.Final.jar
 share/ozone/lib/netty-handler.Final.jar
 share/ozone/lib/netty-resolver.Final.jar
-share/ozone/lib/netty-tcnative-boringssl-static.Final-linux-aarch_64.jar
-share/ozone/lib/netty-tcnative-boringssl-static.Final-linux-x86_64.jar
-share/ozone/lib/netty-tcnative-boringssl-static.Final-osx-aarch_64.jar
-share/ozone/lib/netty-tcnative-boringssl-static.Final-osx-x86_64.jar
-share/ozone/lib/netty-tcnative-boringssl-static.Final-windows-x86_64.jar
-share/ozone/lib/netty-tcnative-boringssl-static.Final.jar
-share/ozone/lib/netty-tcnative-classes.Final.jar
 share/ozone/lib/netty-transport-classes-epoll.Final.jar
 share/ozone/lib/netty-transport-native-epoll.Final.jar
 share/ozone/lib/netty-transport-native-unix-common.Final.jar
@@ -268,10 +248,8 @@ share/ozone/lib/parquet-format-structures.jar
 share/ozone/lib/parquet-hadoop.jar
 share/ozone/lib/parquet-jackson.jar
 share/ozone/lib/parquet-variant.jar
-share/ozone/lib/perfmark-api.jar
 share/ozone/lib/picocli-shell-jline3.jar
 share/ozone/lib/picocli.jar
-share/ozone/lib/proto-google-common-protos.jar
 share/ozone/lib/protobuf-java.jar
 share/ozone/lib/ranger-audit-core.jar
 share/ozone/lib/ranger-authz-api.jar
diff --git a/hadoop-ozone/interface-client/pom.xml 
b/hadoop-ozone/interface-client/pom.xml
index b04bf34a6b6..89841b229b4 100644
--- a/hadoop-ozone/interface-client/pom.xml
+++ b/hadoop-ozone/interface-client/pom.xml
@@ -34,58 +34,14 @@
   </properties>
 
   <dependencies>
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-    </dependency>
     <dependency>
       <groupId>com.google.protobuf</groupId>
       <artifactId>protobuf-java</artifactId>
     </dependency>
-    <dependency>
-      <groupId>io.grpc</groupId>
-      <artifactId>grpc-api</artifactId>
-      <exclusions>
-        <exclusion>
-          <groupId>com.google.code.findbugs</groupId>
-          <artifactId>jsr305</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>io.grpc</groupId>
-      <artifactId>grpc-protobuf</artifactId>
-      <exclusions>
-        <exclusion>
-          <groupId>com.google.code.findbugs</groupId>
-          <artifactId>jsr305</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>io.grpc</groupId>
-      <artifactId>grpc-stub</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.apache.ozone</groupId>
       <artifactId>hdds-interface-client</artifactId>
     </dependency>
-    <dependency>
-      <!-- for generated sources, Java 11+ -->
-      <groupId>javax.annotation</groupId>
-      <artifactId>javax.annotation-api</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-codec-http2</artifactId>
-      <scope>runtime</scope>
-    </dependency>
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-handler-proxy</artifactId>
-      <scope>runtime</scope>
-    </dependency>
   </dependencies>
   <build>
     <plugins>
@@ -114,13 +70,6 @@
                 <version>${protobuf.version}</version>
               </protoc>
               
<outputDirectory>target/generated-sources/proto-java-protobuf-${protobuf.version}</outputDirectory>
-              <plugins>
-                <plugin kind="binary-maven">
-                  <groupId>io.grpc</groupId>
-                  <artifactId>protoc-gen-grpc-java</artifactId>
-                  <version>${io.grpc.version}</version>
-                </plugin>
-              </plugins>
             </configuration>
           </execution>
         </executions>
diff --git a/hadoop-ozone/ozone-manager/pom.xml 
b/hadoop-ozone/ozone-manager/pom.xml
index 1896a4504ee..877ab22c11b 100644
--- a/hadoop-ozone/ozone-manager/pom.xml
+++ b/hadoop-ozone/ozone-manager/pom.xml
@@ -62,36 +62,6 @@
       <groupId>info.picocli</groupId>
       <artifactId>picocli</artifactId>
     </dependency>
-    <dependency>
-      <groupId>io.grpc</groupId>
-      <artifactId>grpc-api</artifactId>
-      <exclusions>
-        <exclusion>
-          <groupId>com.google.code.findbugs</groupId>
-          <artifactId>jsr305</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>io.grpc</groupId>
-      <artifactId>grpc-netty</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>io.grpc</groupId>
-      <artifactId>grpc-stub</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-common</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-handler</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-transport</artifactId>
-    </dependency>
     <dependency>
       <groupId>jakarta.annotation</groupId>
       <artifactId>jakarta.annotation-api</artifactId>
@@ -242,11 +212,6 @@
       <artifactId>hdds-annotation-processing</artifactId>
       <scope>provided</scope>
     </dependency>
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-tcnative-boringssl-static</artifactId>
-      <scope>runtime</scope>
-    </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-reload4j</artifactId>
diff --git 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/GrpcOzoneManagerServer.java
 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/GrpcOzoneManagerServer.java
index b6f5452c600..16fdbb78b6e 100644
--- 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/GrpcOzoneManagerServer.java
+++ 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/GrpcOzoneManagerServer.java
@@ -17,8 +17,6 @@
 
 package org.apache.hadoop.ozone.om;
 
-import static org.apache.hadoop.hdds.HddsConfigKeys.HDDS_GRPC_TLS_PROVIDER;
-import static 
org.apache.hadoop.hdds.HddsConfigKeys.HDDS_GRPC_TLS_PROVIDER_DEFAULT;
 import static 
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_GRPC_BOSSGROUP_SIZE_DEFAULT;
 import static 
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_GRPC_BOSSGROUP_SIZE_KEY;
 import static 
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_GRPC_MAXIMUM_RESPONSE_LENGTH;
@@ -30,16 +28,6 @@
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import io.grpc.Server;
-import io.grpc.ServerInterceptors;
-import io.grpc.netty.GrpcSslContexts;
-import io.grpc.netty.NettyServerBuilder;
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.channel.socket.nio.NioServerSocketChannel;
-import io.netty.handler.ssl.SslContextBuilder;
-import io.netty.handler.ssl.SslProvider;
-import io.netty.handler.ssl.SupportedCipherSuiteFilter;
 import java.io.IOException;
 import java.util.OptionalInt;
 import java.util.concurrent.LinkedBlockingQueue;
@@ -59,6 +47,15 @@
 import 
org.apache.hadoop.ozone.om.protocolPB.grpc.ClientAddressServerInterceptor;
 import 
org.apache.hadoop.ozone.protocolPB.OzoneManagerProtocolServerSideTranslatorPB;
 import org.apache.hadoop.ozone.security.OzoneDelegationTokenSecretManager;
+import org.apache.ratis.thirdparty.io.grpc.Server;
+import org.apache.ratis.thirdparty.io.grpc.ServerInterceptors;
+import org.apache.ratis.thirdparty.io.grpc.netty.GrpcSslContexts;
+import org.apache.ratis.thirdparty.io.grpc.netty.NettyServerBuilder;
+import org.apache.ratis.thirdparty.io.netty.channel.EventLoopGroup;
+import org.apache.ratis.thirdparty.io.netty.channel.nio.NioEventLoopGroup;
+import 
org.apache.ratis.thirdparty.io.netty.channel.socket.nio.NioServerSocketChannel;
+import org.apache.ratis.thirdparty.io.netty.handler.ssl.SslContextBuilder;
+import 
org.apache.ratis.thirdparty.io.netty.handler.ssl.SupportedCipherSuiteFilter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -185,9 +182,7 @@ public void init(OzoneManagerProtocolServerSideTranslatorPB 
omTranslator,
         SslContextBuilder sslClientContextBuilder =
             SslContextBuilder.forServer(caClient.getKeyManager());
         SslContextBuilder sslContextBuilder = GrpcSslContexts.configure(
-            sslClientContextBuilder,
-            SslProvider.valueOf(omServerConfig.get(HDDS_GRPC_TLS_PROVIDER,
-                HDDS_GRPC_TLS_PROVIDER_DEFAULT)));
+            sslClientContextBuilder, secConf.getGrpcSslProvider());
         sslContextBuilder.protocols(secConf.getGrpcTlsProtocols());
         sslContextBuilder.ciphers(
             secConf.getGrpcTlsCiphers(),
diff --git 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManagerServiceGrpc.java
 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManagerServiceGrpc.java
index dd0c0604eff..b3f12bd9605 100644
--- 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManagerServiceGrpc.java
+++ 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManagerServiceGrpc.java
@@ -19,7 +19,6 @@
 
 import com.google.protobuf.RpcController;
 import com.google.protobuf.ServiceException;
-import io.grpc.Status;
 import java.util.EnumSet;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -27,19 +26,23 @@
 import org.apache.hadoop.ipc_.RPC;
 import org.apache.hadoop.ipc_.Server;
 import org.apache.hadoop.ozone.om.protocolPB.grpc.OMGrpcError;
+import 
org.apache.hadoop.ozone.om.protocolPB.grpc.OzoneManagerServiceGrpcBinding;
 import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest;
 import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse;
 import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type;
-import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerServiceGrpc.OzoneManagerServiceImplBase;
 import 
org.apache.hadoop.ozone.protocolPB.OzoneManagerProtocolServerSideTranslatorPB;
 import org.apache.hadoop.ozone.util.UUIDUtil;
+import org.apache.ratis.thirdparty.io.grpc.BindableService;
+import org.apache.ratis.thirdparty.io.grpc.ServerServiceDefinition;
+import org.apache.ratis.thirdparty.io.grpc.Status;
+import org.apache.ratis.thirdparty.io.grpc.stub.StreamObserver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * Grpc Service for handling S3 gateway OzoneManagerProtocol client requests.
  */
-public class OzoneManagerServiceGrpc extends OzoneManagerServiceImplBase {
+public class OzoneManagerServiceGrpc implements BindableService {
   private static final Logger LOG =
       LoggerFactory.getLogger(OzoneManagerServiceGrpc.class);
   /**
@@ -67,9 +70,11 @@ public class OzoneManagerServiceGrpc extends 
OzoneManagerServiceImplBase {
   }
 
   @Override
-  public void submitRequest(OMRequest request,
-                            io.grpc.stub.StreamObserver<OMResponse>
-                                responseObserver) {
+  public ServerServiceDefinition bindService() {
+    return OzoneManagerServiceGrpcBinding.bindService(this::submitRequest);
+  }
+
+  public void submitRequest(OMRequest request, StreamObserver<OMResponse> 
responseObserver) {
     LOG.debug("OzoneManagerServiceGrpc: OzoneManagerServiceImplBase " +
         "processing s3g client submit request - for command {}",
         request.getCmdType().name());
diff --git 
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestGrpcMetricsInterceptorBenchmark.java
 
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestGrpcMetricsInterceptorBenchmark.java
index ca53639824e..f7ba352be47 100644
--- 
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestGrpcMetricsInterceptorBenchmark.java
+++ 
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestGrpcMetricsInterceptorBenchmark.java
@@ -23,11 +23,6 @@
 
 import com.google.protobuf.AbstractMessage;
 import com.google.protobuf.ByteString;
-import io.grpc.ForwardingServerCallListener.SimpleForwardingServerCallListener;
-import io.grpc.Metadata;
-import io.grpc.ServerCall;
-import io.grpc.ServerCallHandler;
-import io.grpc.ServerInterceptor;
 import java.lang.management.GarbageCollectorMXBean;
 import java.lang.management.ManagementFactory;
 import java.util.ArrayList;
@@ -49,6 +44,11 @@
 import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OzoneAclInfo;
 import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type;
 import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.UserInfo;
+import 
org.apache.ratis.thirdparty.io.grpc.ForwardingServerCallListener.SimpleForwardingServerCallListener;
+import org.apache.ratis.thirdparty.io.grpc.Metadata;
+import org.apache.ratis.thirdparty.io.grpc.ServerCall;
+import org.apache.ratis.thirdparty.io.grpc.ServerCallHandler;
+import org.apache.ratis.thirdparty.io.grpc.ServerInterceptor;
 import org.junit.jupiter.api.Tag;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Timeout;
diff --git 
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestGrpcOzoneManagerServer.java
 
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestGrpcOzoneManagerServer.java
index ef15f62e274..a6858786adb 100644
--- 
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestGrpcOzoneManagerServer.java
+++ 
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestGrpcOzoneManagerServer.java
@@ -33,8 +33,6 @@
 import static org.mockito.Mockito.when;
 
 import com.google.protobuf.ServiceException;
-import io.grpc.StatusRuntimeException;
-import io.grpc.stub.StreamObserver;
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import 
org.apache.hadoop.hdds.security.x509.certificate.client.CertificateClient;
 import org.apache.hadoop.hdds.security.x509.exception.CertificateException;
@@ -48,6 +46,8 @@
 import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type;
 import 
org.apache.hadoop.ozone.protocolPB.OzoneManagerProtocolServerSideTranslatorPB;
 import org.apache.ratis.protocol.RaftPeerId;
+import org.apache.ratis.thirdparty.io.grpc.StatusRuntimeException;
+import org.apache.ratis.thirdparty.io.grpc.stub.StreamObserver;
 import org.junit.jupiter.api.Test;
 import org.mockito.ArgumentCaptor;
 
diff --git 
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestOMMetadataReader.java
 
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestOMMetadataReader.java
index 648c3a97a7d..032ff71890f 100644
--- 
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestOMMetadataReader.java
+++ 
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestOMMetadataReader.java
@@ -45,7 +45,6 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import io.grpc.Context;
 import java.io.IOException;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
@@ -79,6 +78,7 @@
 import org.apache.hadoop.ozone.util.ConcurrentMutableRate;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.ozone.test.HddsWhiteboxTestUtils;
+import org.apache.ratis.thirdparty.io.grpc.Context;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
diff --git 
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/TestOMClientRequestWithUserInfo.java
 
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/TestOMClientRequestWithUserInfo.java
index 9dc8bb408c7..85156667d9e 100644
--- 
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/TestOMClientRequestWithUserInfo.java
+++ 
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/TestOMClientRequestWithUserInfo.java
@@ -28,7 +28,6 @@
 import static org.mockito.Mockito.mockStatic;
 import static org.mockito.Mockito.when;
 
-import io.grpc.Context;
 import java.io.IOException;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
@@ -58,6 +57,7 @@
 import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.S3Authentication;
 import org.apache.hadoop.ozone.security.STSTokenIdentifier;
 import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.ratis.thirdparty.io.grpc.Context;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.io.TempDir;
diff --git a/hadoop-ozone/ozonefs-shaded/pom.xml 
b/hadoop-ozone/ozonefs-shaded/pom.xml
index 802abc94031..9627b954cac 100644
--- a/hadoop-ozone/ozonefs-shaded/pom.xml
+++ b/hadoop-ozone/ozonefs-shaded/pom.xml
@@ -27,6 +27,7 @@
   <properties>
     <ban-httpcomponents.skip>false</ban-httpcomponents.skip>
     <ban-rocksdb.skip>false</ban-rocksdb.skip>
+    <ban-unshaded-grpc.skip>false</ban-unshaded-grpc.skip>
     
<maven.compiler.release>${ozone.java.version.client}</maven.compiler.release>
     <!-- no tests in this module so far -->
     <maven.test.skip>true</maven.test.skip>
@@ -40,30 +41,6 @@
       <groupId>com.google.protobuf</groupId>
       <artifactId>protobuf-java</artifactId>
     </dependency>
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-resolver-dns-native-macos</artifactId>
-      <classifier>osx-x86_64</classifier>
-    </dependency>
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-tcnative-boringssl-static</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-transport-native-epoll</artifactId>
-      <classifier>linux-aarch_64</classifier>
-    </dependency>
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-transport-native-epoll</artifactId>
-      <classifier>linux-x86_64</classifier>
-    </dependency>
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-transport-native-kqueue</artifactId>
-      <classifier>osx-x86_64</classifier>
-    </dependency>
     <dependency>
       <groupId>org.apache.ozone</groupId>
       <artifactId>ozone-filesystem-common</artifactId>
@@ -169,16 +146,6 @@
                     
<exclude>META-INF/native/liborg_apache_ratis_thirdparty_netty_transport_native_kqueue_aarch_64.jnilib</exclude>
                     
<exclude>META-INF/native/liborg_apache_ratis_thirdparty_netty_transport_native_kqueue_x86_64.jnilib</exclude>
                     
<exclude>META-INF/native/org_apache_ratis_thirdparty_netty_tcnative_windows_x86_64.dll</exclude>
-                    <!-- Filter unshaded netty_tcnative libs -->
-                    
<exclude>META-INF/native/libnetty_resolver_dns_native_macos_x86_64.jnilib</exclude>
-                    
<exclude>META-INF/native/libnetty_tcnative_linux_aarch_64.so</exclude>
-                    
<exclude>META-INF/native/libnetty_tcnative_linux_x86_64.so</exclude>
-                    
<exclude>META-INF/native/libnetty_tcnative_osx_aarch_64.jnilib</exclude>
-                    
<exclude>META-INF/native/libnetty_tcnative_osx_x86_64.jnilib</exclude>
-                    
<exclude>META-INF/native/libnetty_transport_native_epoll_aarch_64.so</exclude>
-                    
<exclude>META-INF/native/libnetty_transport_native_epoll_x86_64.so</exclude>
-                    
<exclude>META-INF/native/libnetty_transport_native_kqueue_x86_64.jnilib</exclude>
-                    
<exclude>META-INF/native/netty_tcnative_windows_x86_64.dll</exclude>
                   </excludes>
                 </filter>
               </filters>
@@ -311,12 +278,9 @@
             </goals>
             <phase>validate</phase>
             <configuration>
-              <includeGroupIds>io.netty,org.apache.ratis</includeGroupIds>
+              <includeGroupIds>org.apache.ratis</includeGroupIds>
               <includes>**/META-INF/native/*</includes>
-              <includeArtifactIds>netty-resolver-dns-native-macos,
-                netty-tcnative-boringssl-static,
-                netty-transport-native-epoll,
-                
netty-transport-native-kqueue,ratis-thirdparty-misc</includeArtifactIds>
+              <includeArtifactIds>ratis-thirdparty-misc</includeArtifactIds>
               
<outputDirectory>${project.build.directory}/classes/</outputDirectory>
               <overWriteReleases>true</overWriteReleases>
               <overWriteSnapshots>true</overWriteSnapshots>
@@ -382,42 +346,6 @@
                   
<sourceFile>${project.build.directory}/classes/META-INF/native/${ratis.thirdparty.shaded.native.prefix}netty_tcnative_windows_x86_64.dll</sourceFile>
                   
<destinationFile>${project.build.directory}/classes/META-INF/native/${ozone.shaded.native.prefix}_${ratis.thirdparty.shaded.native.prefix}netty_tcnative_windows_x86_64.dll</destinationFile>
                 </fileSet>
-                <fileSet>
-                  
<sourceFile>${project.build.directory}/classes/META-INF/native/libnetty_resolver_dns_native_macos_x86_64.jnilib</sourceFile>
-                  
<destinationFile>${project.build.directory}/classes/META-INF/native/lib${ozone.shaded.native.prefix}_netty_resolver_dns_native_macos_x86_64.jnilib</destinationFile>
-                </fileSet>
-                <fileSet>
-                  
<sourceFile>${project.build.directory}/classes/META-INF/native/libnetty_transport_native_epoll_aarch_64.so</sourceFile>
-                  
<destinationFile>${project.build.directory}/classes/META-INF/native/lib${ozone.shaded.native.prefix}_netty_transport_native_epoll_aarch_64.so</destinationFile>
-                </fileSet>
-                <fileSet>
-                  
<sourceFile>${project.build.directory}/classes/META-INF/native/libnetty_transport_native_epoll_x86_64.so</sourceFile>
-                  
<destinationFile>${project.build.directory}/classes/META-INF/native/lib${ozone.shaded.native.prefix}_netty_transport_native_epoll_x86_64.so</destinationFile>
-                </fileSet>
-                <fileSet>
-                  
<sourceFile>${project.build.directory}/classes/META-INF/native/libnetty_transport_native_kqueue_x86_64.jnilib</sourceFile>
-                  
<destinationFile>${project.build.directory}/classes/META-INF/native/lib${ozone.shaded.native.prefix}_netty_transport_native_kqueue_x86_64.jnilib</destinationFile>
-                </fileSet>
-                <fileSet>
-                  
<sourceFile>${project.build.directory}/classes/META-INF/native/libnetty_tcnative_linux_aarch_64.so</sourceFile>
-                  
<destinationFile>${project.build.directory}/classes/META-INF/native/lib${ozone.shaded.native.prefix}_netty_tcnative_linux_aarch_64.so</destinationFile>
-                </fileSet>
-                <fileSet>
-                  
<sourceFile>${project.build.directory}/classes/META-INF/native/libnetty_tcnative_linux_x86_64.so</sourceFile>
-                  
<destinationFile>${project.build.directory}/classes/META-INF/native/lib${ozone.shaded.native.prefix}_netty_tcnative_linux_x86_64.so</destinationFile>
-                </fileSet>
-                <fileSet>
-                  
<sourceFile>${project.build.directory}/classes/META-INF/native/libnetty_tcnative_osx_aarch_64.jnilib</sourceFile>
-                  
<destinationFile>${project.build.directory}/classes/META-INF/native/lib${ozone.shaded.native.prefix}_netty_tcnative_osx_aarch_64.jnilib</destinationFile>
-                </fileSet>
-                <fileSet>
-                  
<sourceFile>${project.build.directory}/classes/META-INF/native/libnetty_tcnative_osx_x86_64.jnilib</sourceFile>
-                  
<destinationFile>${project.build.directory}/classes/META-INF/native/lib${ozone.shaded.native.prefix}_netty_tcnative_osx_x86_64.jnilib</destinationFile>
-                </fileSet>
-                <fileSet>
-                  
<sourceFile>${project.build.directory}/classes/META-INF/native/netty_tcnative_windows_x86_64.dll</sourceFile>
-                  
<destinationFile>${project.build.directory}/classes/META-INF/native/${ozone.shaded.native.prefix}_netty_tcnative_windows_x86_64.dll</destinationFile>
-                </fileSet>
               </fileSets>
             </configuration>
           </execution>
diff --git a/hadoop-ozone/s3gateway/pom.xml b/hadoop-ozone/s3gateway/pom.xml
index 589654d1ba3..e45d2b71cc1 100644
--- a/hadoop-ozone/s3gateway/pom.xml
+++ b/hadoop-ozone/s3gateway/pom.xml
@@ -203,16 +203,6 @@
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
     </dependency>
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-codec-http2</artifactId>
-      <scope>runtime</scope>
-    </dependency>
-    <dependency>
-      <groupId>io.netty</groupId>
-      <artifactId>netty-handler-proxy</artifactId>
-      <scope>runtime</scope>
-    </dependency>
     <dependency>
       <groupId>org.glassfish.hk2</groupId>
       <artifactId>hk2-api</artifactId>
diff --git a/pom.xml b/pom.xml
index 9d1b84fcb21..e9f0128aebc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -42,6 +42,7 @@
     <aws-java-sdk2.version>2.55.6</aws-java-sdk2.version>
     <ban-httpcomponents.skip>true</ban-httpcomponents.skip>
     <ban-rocksdb.skip>true</ban-rocksdb.skip>
+    <ban-unshaded-grpc.skip>true</ban-unshaded-grpc.skip>
     <bonecp.version>0.8.0.RELEASE</bonecp.version>
     <bouncycastle.version>1.86</bouncycastle.version>
     
<build-helper-maven-plugin.version>3.6.2</build-helper-maven-plugin.version>
@@ -2159,6 +2160,26 @@
                 </rules>
               </configuration>
             </execution>
+            <execution>
+              <id>ban-unshaded-grpc</id>
+              <goals>
+                <goal>enforce</goal>
+              </goals>
+              <phase>validate</phase>
+              <configuration>
+                <!-- enabled in the shaded filesystem module -->
+                <skip>${ban-unshaded-grpc.skip}</skip>
+                <rules>
+                  <bannedDependencies>
+                    <excludes>
+                      <exclude>io.grpc</exclude>
+                      <exclude>io.netty</exclude>
+                    </excludes>
+                    <message>The Ozone filesystem jar must use Ratis's shaded 
gRPC and Netty, not unshaded io.grpc / io.netty</message>
+                  </bannedDependencies>
+                </rules>
+              </configuration>
+            </execution>
             <execution>
               <id>ban-httpcomponents</id>
               <goals>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to