GRPC-.IllegalArgumentException:未正确配置码头ALPN/NPN [英] GRPC - .IllegalArgumentException: Jetty ALPN/NPN has not been properly configured
问题描述
我正在尝试在Pod的docker容器中启用TLS的情况下启动GRPC服务器,但在服务器启动过程中出现以下错误
I am trying to spin up the GRPC server with TLS enabled in docker container on pods but getting below error during server start up
我正在尝试引用 https://github.com/grpc/grpc-java/blob/master/SECURITY.md#transport-security-tls
Java:jdk1.8.0_131 OpenSSL版本:OpenSSL 1.0.1e-fips
Java : jdk1.8.0_131 OpenSSL version: OpenSSL 1.0.1e-fips
例外:
*Exception in thread "main" java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured.
at io.grpc.netty.GrpcSslContexts.selectApplicationProtocolConfig(GrpcSslContexts.java:174)
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:151)
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:139)
at io.grpc.netty.GrpcSslContexts.forServer(GrpcSslContexts.java:119)
at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:377)
at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:63)*
还想知道如何在本地测试openssl方法?
also want to know how I can test openssl approach locally ?
这是我尝试运行jar的方式:java -jar -Denv = e1 app.jar
this is how I am trying to run the jar: java -jar -Denv=e1 app.jar
以下是特定于GRPC的其他与GRPC相关的POM依赖项-我在POM中具有: -扩展名-
Below are the additional GRPC related POM dependencies specific to GRPC -I have in my POM: -- extension --
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.4.0.Final</version>
</extension>
</extensions>
-插件----
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.0</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.2.0:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.3.0:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
---依赖关系---
--- dependencies ---
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>2.0.1.Final</version>
</dependency>
Openssl/jdk版本可能是问题吗?
Can Openssl / jdk version be the problem ?
推荐答案
您需要添加对Netty TCNative的依赖关系,以获得正确的安全依赖关系.来自 gRPC的SECURITY.md 文件,您需要添加以下内容:
You need to add a dependency on Netty TCNative in order to get a correct security dependecy. From the SECURITY.md file for gRPC, you need to add the following:
<project>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>1.1.33.Fork26</version>
</dependency>
</dependencies>
</project>
请注意,这将在即将发布的gRPC 1.4版本中更改为指向netty-tcnative-parent-2.0.1.Final
Note that this will change in the upcoming 1.4 release of gRPC to point to netty-tcnative-parent-2.0.1.Final
这篇关于GRPC-.IllegalArgumentException:未正确配置码头ALPN/NPN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!