java - java Google: Jetty ALPN/npn還沒有正確配置

  显示原文与译文双语对照的内容

在使用 Google Pubsub來列出主題時,我的web應用程序正在tomcat上運行。


public static List<String> listTopics(GcpCredentials gcCredentials, String project) throws GCPException, IOException


{


 List<String> topics = new ArrayList<>();


 TopicAdminClient client = getTopicClient(gcCredentials);


 ProjectName projectName = ProjectName.create(project);


 ListTopicsPagedResponse response = client.listTopics(projectName);


 for (Topic topic :response.iterateAll())


 {


 topics.add(topic.getNameAsTopicName().getTopic());


 }


 return topics;


}`



異常:

java.lang.IllegalArgumentException: Jetty ALPN/npn沒有正確配置。
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.forClient(GrpcSslContexts.java:109) at io.grpc. netty.NettyChannelBuilder.createProtocolNegotiatorByType(NettyChannelBuilder.java:335) at io.grpc. netty.NettyChannelBuilder.createProtocolNegotiator(NettyChannelBuilder.java:308) at io.grpc. netty.NettyChannelBuilder$NettyTransportFactory$DynamicNettyTransportParams.getProtocolNegotiator(NettyChannelBuilder.java:499) at io.grpc. netty.NettyChannelBuilder$NettyTransportFactory.newClientTransport(NettyChannelBuilder.java:448) at io.grpc. internal.CallCredentialsApplyingTransportFactory.newClientTransport(CallCredentialsApplyingTransportFactory.java:61) at io.grpc. internal.InternalSubchannel.startNewTransport(InternalSubchannel.java:209) at io.grpc. internal.InternalSubchannel.obtainActiveTransport(InternalSubchannel.java:186) at io.grpc. internal.ManagedChannelImpl$SubchannelImplImpl.obtainActiveTransport(ManagedChannelImpl.java:806) at io.grpc. internal.GrpcUtil.getTransportFromPickResult(GrpcUtil.java:568) at io.grpc. internal.DelayedClientTransport.reprocess(DelayedClientTransport.java:296) at io.grpc. internal.ManagedChannelImpl$LbHelperImpl$5.run(ManagedChannelImpl.java:724) at io.grpc. internal.ChannelExecutor.drain(ChannelExecutor.java:87) at io.grpc. internal.ManagedChannelImpl$LbHelperImpl.runSerialized(ManagedChannelImpl.java:715) at io.grpc. internal.ManagedChannelImpl$NameResolverListenerImpl.onUpdate(ManagedChannelImpl.java:752) at io.grpc. internal.DnsNameResolver$1.run(DnsNameResolver.java:174) at java.util. concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util. concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang. Thread.run(Thread.java:745 )

时间: 原作者:

我已經觀察到了網狀版本 4.1.15. Final的問題,但是不用 4.1.13. Final. 檢查傳遞依賴關係。 例如 Spring Boot 引用聯網。

我添加到POM中,使它的能夠使用扳手API版本 0.22.0 -beta:

<properties> <v.netty>4.1.13.Final</v.netty> </properties>. .. <dependencyManagement> <dependencies> <dependency> <groupId>io.netty</groupId> <artifactId>netty-codec</artifactId> <version>${v.netty}</version> </dependency> <dependency> <groupId>io.netty</groupId> <artifactId>netty-codec-http</artifactId> <version>${v.netty}</version> </dependency> <dependency> <groupId>io.netty</groupId> <artifactId>netty-codec-http2</artifactId> <version>${v.netty}</version> </dependency> <dependency> <groupId>io.netty</groupId> <artifactId>netty-handler</artifactId> <version>${v.netty}</version> </dependency> <dependency> <groupId>io.netty</groupId> <artifactId>netty-common</artifactId> <version>${v.netty}</version> </dependency> <dependency> <groupId>io.netty</groupId> <artifactId>netty-handler-proxy</artifactId> <version>${v.netty}</version> </dependency> <dependency> <groupId>io.netty</groupId> <artifactId>netty-transport</artifactId> <version>${v.netty}</version> </dependency> <dependency> <groupId>io.netty</groupId> <artifactId>netty-resolver</artifactId> <version>${v.netty}</version> </dependency> <dependency> <groupId>io.netty</groupId> <artifactId>netty-codec-socks</artifactId> <version>${v.netty}</version> </dependency> <dependency> <groupId>io.netty</groupId> <artifactId>netty-buffer</artifactId> <version>${v.netty}</version> </dependency> </dependencies> </dependencyManagement>

如果問題仍然存在,或者如果沒有選擇,plase將使用適當的bootclasspath條目運行你的JVM,例如:

java -Xbootclasspath/p:/tmp/alpn-boot-8.1.11.v20170118.jar -cp.. .

請務必更換 /tmp/alpn-boot-8.1.11.v20170118.jar 與你的JVM版本匹配的ALPN jar的位置與這裡頁面上列出的版本匹配: https://www.eclipse.org/jetty/documentation/9.4.x/alpn-chapter.html

原作者:
...