我试图在pods上的docker容器中启用TLS启动GRPC服务器,但在服务器启动时收到以下错误
我正在尝试引用https://github.com/grpc/grpc-java/blob/master/SECURITY.md#transport-security-tls
Java:jdk1.8.0_131 OpenSSL版本: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)*
Run Code Online (Sandbox Code Playgroud)
还想知道如何在本地测试openssl方法?
这就是我试图运行jar的方式:java -jar -Denv = e1 app.jar
以下是GRPC特有的与GRPC相关的POM依赖关系-I在我的POM中: - 扩展 -
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.4.0.Final</version>
</extension>
</extensions>
Run Code Online (Sandbox Code Playgroud)
- - 插入 - -
<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>
Run Code Online (Sandbox Code Playgroud)
---依赖---
<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>
Run Code Online (Sandbox Code Playgroud)
Openssl/jdk版本可以成为问题吗?
您需要添加对 Netty TCNative 的依赖才能获得正确的安全依赖。在gRPC 的SECURITY.md文件中,您需要添加以下内容:
<project>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>1.1.33.Fork26</version>
</dependency>
</dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)
请注意,这将在即将发布的 gRPC 1.4 版本中更改为指向netty-tcnative-parent-2.0.1.Final
| 归档时间: |
|
| 查看次数: |
3123 次 |
| 最近记录: |