我正在通过 Google Cloud Java 客户端库使用 Google DLP,当我升级到最新版本 0.44.0-beta 时,我开始得到CertificateException
如下所示的内容。当我在带有 Oracle JDK 8 的 Mac 上运行它时,它运行良好,但是当在 Docker 实例中的 OpenJDK 8 中运行时,我看到了异常。我必须在 OpenJDK 上运行它。我猜证书是由 OpenJDK 未知的 CA 签署的。最简单的解决方案是什么?我是否必须为 OpenJDK 安装自定义 CA?有趣的是,OverOps 快照包含对这个方法的调用:
public io.grpc.netty.shaded.io.netty.handler.ssl.util.SelfSignedCertificate(String fqdn, SecureRandom random, int bits, Date notBefore, Date notAfter)
并且fqdn
参数实际上设置为example.com
。堆栈跟踪如下:
CertificateException: Issuer class type invalid.
at sun.security.x509.X509CertInfo.setIssuer(Object)
at sun.security.x509.X509CertInfo.set(String, Object)
at io.grpc.netty.shaded.io.netty.handler.ssl.util.OpenJdkSelfSignedCertGenerator.generate(String, KeyPair, SecureRandom, Date, Date)
at io.grpc.netty.shaded.io.netty.handler.ssl.util.SelfSignedCertificate.<init>(String, SecureRandom, int, Date, Date)
at io.grpc.netty.shaded.io.netty.handler.ssl.util.SelfSignedCertificate.<init>(String, Date, Date)
at io.grpc.netty.shaded.io.netty.handler.ssl.util.SelfSignedCertificate.<init>(Date, Date)
at io.grpc.netty.shaded.io.netty.handler.ssl.util.SelfSignedCertificate.<init>()
at io.grpc.netty.shaded.io.netty.handler.ssl.OpenSsl.<clinit>()
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.defaultSslProvider()
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.configure(SslContextBuilder)
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.forClient()
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyTransportFactory$DefaultNettyTransportCreationParamsFilterFactory.<init>(NettyChannelBuilder$NettyTransportFactory, SslContext)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyTransportFactory$DefaultNettyTransportCreationParamsFilterFactory.<init>(NettyChannelBuilder$NettyTransportFactory, SslContext, NettyChannelBuilder$1)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyTransportFactory.<init>(NettyChannelBuilder$TransportCreationParamsFilterFactory, Class, Map, NegotiationType, SslContext, EventLoopGroup, int, int, int, long, long, boolean, TransportTracer)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.buildTransportFactory()
at io.grpc.internal.AbstractManagedChannelImplBuilder.build()
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel()
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel()
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel()
at com.google.api.gax.rpc.ClientContext.create(StubSettings)
at com.google.cloud.dlp.v2beta1.stub.GrpcDlpServiceStub.create(DlpServiceStubSettings)
at com.google.cloud.dlp.v2beta1.stub.DlpServiceStubSettings.createStub()
at com.google.cloud.dlp.v2beta1.DlpServiceClient.<init>(DlpServiceSettings)
at com.google.cloud.dlp.v2beta1.DlpServiceClient.create(DlpServiceSettings)
at XXXXXXXX.redactContent(Collection, String, Likelihood, List)
at XXXXXXXX.lambda$redact$0(Collection, String, Likelihood, List)
at java.util.concurrent.CompletableFuture$AsyncSupply.run()
at java.lang.Thread.run()