简体   繁体   English

Java GRPC TLS客户端无法执行

[英]Java GRPC TLS client failing to get executed

I am fairly new to GRPC and Java GRPC is my intent to work on. 我对GRPC相当陌生,而Java GRPC是我的工作目标。 I have a GRPC server running successfully behind an envoy Load Balancer secured using X.509 based certs/keys. 我有一个GRPC服务器在使用基于X.509的证书/密钥保护的Envoy负载均衡器后成功运行。 Now, I am facing problem while creating a client for same. 现在,在为它创建客户端时遇到了问题。

Maven repository suggests that latest io.grpc version available is 1.17.1 and the examples mentioned on the Github for GRPC is 1.19.0-SNAPSHOT or 1.17.3-SNAPSHOT. Maven存储库建议可用的最新io.grpc版本是1.17.1,Github上提到的GRPC示例是1.19.0-SNAPSHOT或1.17.3-SNAPSHOT。

I did copied the whole repo and build/install the code on my local dev environment where I am facing an issue while running the client (TLS) example as well as my own code. 我确实复制了整个存储库,并在运行客户端(TLS)示例以及我自己的代码时遇到问题的本地开发环境中构建/安装了代码。

My pom is 我的pom是

<properties>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <grpc.version>1.19.0-SNAPSHOT</grpc.version><!-- CURRENT_GRPC_VERSION -->
                <protoc.version>3.5.1-1</protoc.version>
                <netty.tcnative.version>2.0.20.Final</netty.tcnative.version>
                <!-- required for jdk9 -->
                <maven.compiler.source>1.8</maven.compiler.source>
                <maven.compiler.target>1.8</maven.compiler.target>
        </properties>

and the error I am getting is related to the protoc-gen-grpc-java, 我得到的错误与protoc-gen-grpc-java有关,

io.grpc:protoc-gen-grpc-java:exe:linux-x86_64:1.19.0-SNAPSHOT

I have build and installed the GRPC-JAVA as per their git page with skipcodegen=true property and it is supposed to locally install the required jars in local maven repo. 我已经按照他们的git页面使用skipcodegen = true属性构建并安装了GRPC-JAVA,它应该在本地Maven存储库中本地安装所需的jar。 Looks like other are there like protobuf, etc but not this one. 看起来像其他还有protobuf等,但不是这一类。

Then I tried with 1.17.1 which is latest available on Maven and my pom is 然后我尝试使用Maven上最新可用的1.17.1,而我的pom是

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <grpc.version>1.17.1</grpc.version><!-- CURRENT_GRPC_VERSION -->
        <protobuf.version>3.5.1</protobuf.version>
        <protoc.version>3.5.1-1</protoc.version>
        <netty.tcnative.version>2.0.7.Final</netty.tcnative.version>
        <!-- required for jdk9 -->
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

Here the error is - 这里的错误是-

An exception occured while executing the Java class. Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available

I am not exactly sure what can be the issue and any help would be really appreciable. 我不确定这可能是什么问题,任何帮助都将是真的。

J Ĵ

You should generally not use SNAPSHOT versions. 通常,您不应该使用SNAPSHOT版本。 The examples do not use SNAPSHOT versions for release tags. 这些示例未将SNAPSHOT版本用于发行标签。 Check out the most recent release tag when trying out the examples. 试用示例时,请签出最新的发行标签。 That should resolve any problem with protoc-gen-grpc-java missing (caused by skipCodegen=true ). 这应该可以解决protoc-gen-grpc-java缺失(由skipCodegen=true引起)的任何问题。

There should be INFO level logs just before the "Could not find TLS ALPN provider" exception threw. 在抛出“找不到TLS ALPN提供程序”异常之前,应该有INFO级别的日志。 There are three important log entries: "netty-tcnative unavailable (this may be normal)", "Conscrypt not found (this may be normal)", and "Jetty ALPN unavailable (this may be normal)". 有三个重要的日志条目:“ netty-tcnative不可用(这可能是正常的)”,“未发现Conscrypt(这可能是正常的)”和“ Jetty ALPN不可用(这可能是正常的)”。 They will have exceptions will additional information that should make the problem more clear. 他们将有例外,其他信息将使问题更加清楚。

If you still have trouble, try running the Google Cloud Compat Checker . 如果仍有问题,请尝试运行Google Cloud Compat Checker It checks for common problems that would prevent ALTS from functioning. 它检查是否会阻止ALTS正常运行的常见问题。

You can also reference gRPC's SECURITY.md for troubleshooting information. 您也可以参考gRPC的SECURITY.md以获得故障排除信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM