Google-Cloud:Jetty ALPN / NPN尚未正确配置 [英] Google-Cloud: Jetty ALPN/NPN has not been properly configured

查看:198
本文介绍了Google-Cloud:Jetty ALPN / NPN尚未正确配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用Google Pubsub列出主题时获得例外,我的web应用程序在tomcat上运行。

  public static List< String> ; listTopics(GcpCredentials gcCredentials,String project)抛出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());
}
返回主题;

code


例外:

$ b < BLOCKQUOTE>

java.lang.IllegalArgumentException异常:码头ALPN / NPN尚未正确配置
$在io.grpc.netty.GrpcSslContexts.selectApplicationProtocolConfig(GrpcSslContexts.java:174)b $ b在io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:151)

在io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:139)
在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 :4 48)
。在io.grpc.internal.CallCredentialsApplyingTransportFactory.newClientTransport(CallCredentialsApplyingTransportFactory.java:61)
。在io.grpc.internal.InternalSubchannel.startNewTransport(InternalSubchannel.java:209)
。在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的:在io.grpc.internal.ChannelExecutor.drain(ChannelExecutor.java:87 724)

在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)
。在java.util.concurrent.ThreadPoolExecutor中$ Worker.run(ThreadPoolExecutor.java:617)
。在java.lang.Thread.run(Thread.java:745)



解决方案

我用Netty 4.1.15.Final观察了这个问题,但没有用4.1.13.Final。检查你的传递依赖。即Spring Boot引用Netty。



我添加到POM以使其与Spanner API版本0.22.0-beta一起工作:



<属性>
< v.netty> 4.1.13.Final< /v.netty>
< / properties>
...
< dependencyManagement>
<依赖关系>
< dependency>
< groupId> io.netty< / groupId>
< artifactId> netty-codec< / artifactId>
<版本> $ {v.netty}< / version>
< /依赖关系>
< dependency>
< groupId> io.netty< / groupId>
< artifactId> netty-codec-http< / artifactId>
<版本> $ {v.netty}< / version>
< /依赖关系>
< dependency>
< groupId> io.netty< / groupId>
< artifactId> netty-codec-http2< / artifactId>
<版本> $ {v.netty}< / version>
< /依赖关系>
< dependency>
< groupId> io.netty< / groupId>
< artifactId> netty-handler< / artifactId>
<版本> $ {v.netty}< / version>
< /依赖关系>
< dependency>
< groupId> io.netty< / groupId>
< artifactId> netty-common< / artifactId>
<版本> $ {v.netty}< / version>
< /依赖关系>
< dependency>
< groupId> io.netty< / groupId>
< artifactId> netty-handler-proxy< / artifactId>
<版本> $ {v.netty}< / version>
< /依赖关系>
< dependency>
< groupId> io.netty< / groupId>
< artifactId> netty-transport< / artifactId>
<版本> $ {v.netty}< / version>
< /依赖关系>
< dependency>
< groupId> io.netty< / groupId>
< artifactId> netty-resolver< / artifactId>
<版本> $ {v.netty}< / version>
< /依赖关系>
< dependency>
< groupId> io.netty< / groupId>
< artifactId> netty-codec-socks< / artifactId>
<版本> $ {v.netty}< / version>
< /依赖关系>
< dependency>
< groupId> io.netty< / groupId>
< artifactId> netty-buffer< / artifactId>
<版本> $ {v.netty}< / version>
< /依赖关系>
< /依赖关系>
< / dependencyManagement>



如果问题仍然存在,或者它不是选项,请运行适当的JVM bootclasspath条目,如:



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


Getting exception whilst using Google Pubsub to list topics, my web application is running on 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;
}`

Exception:

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.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)

解决方案

I have observed this problem with Netty version 4.1.15.Final but not with 4.1.13.Final. Check your transitive dependencies. I.e Spring Boot references Netty.

What I added to POM to make it work with Spanner API version 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>

If the problem persists, or if it is not an option, plase run your JVM with appropriate bootclasspath entry, like:

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

Make sure to replace /tmp/alpn-boot-8.1.11.v20170118.jar with location of alpn jar that matches your JVM version as listed on this page: https://www.eclipse.org/jetty/documentation/9.4.x/alpn-chapter.html

这篇关于Google-Cloud:Jetty ALPN / NPN尚未正确配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆