Google-Cloud: Jetty ALPN / NPN is not configured correctly

Getting an exception when using Google Pubsub to display themes, my web app 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;
}`

      

An exception:

java.lang.IllegalArgumentException: Jetty ALPN / NPN is not configured correctly.
    in io.grpc.netty.GrpcSslContexts.selectApplicationProtocolConfig (GrpcSslContexts.java:174) in io.grpc.netty.GrpcSslContexts.configure (GrpcSslContexts.java:151) in io.Grpava:151 file io.Grpava:151) in io.Grpava:151 139) at io.grpc.netty.GrpcSslContexts.forClient (GrpcSslContexts.java:109) at io.grpc.netty.NettyChannelBuilder.createProtocolNegotiatorByType (NettyChannelBuilder.jio:rnatetype) : 308) at io.grpc.netty.NettyChannelBuilder $ NettyTransportFactory $ DynamicNettyTransportParams.getProtocolNegotiator (NettyChannelBuilder.java:499) at io.grpc.netty.NettyChannelBuilder $ Netty.TransportFlictory. CallCredentialsApplyingTransportFactory.newClientTransport (CallCredentialsApplyingTransportFactory.java:61) to io.grpc.internal.InternalSubchannel.startNewTransport (InternalSubchannel.java:209) to io.grpc.internal.InternalSubchannel.obtainActiveTranselport (InternalSubchannel.obtainActiveTranselport (InternalSubchannel.imaged) $ SubchannelImplImpl.obtainActiveTransport (ManagedChannelImpl.java:806) at io.grpc.internal.GrpcUtil.getTransportFromPickResult (GrpcUtil.java:568) at io.grpc.internal.DelayedClientTransport.reprocess (DelayedClientTransport.reprocess) (DelayedClientTransport.reprocess) internal.ManagedChannelImpl $ LbHelperImpl $ 5.run (ManagedChannelImpl.java:724) at io.grpc.internal.ChannelExecutor.drain (ChannelExecutor.java:87) at io.grpc.internal.ManagedChannelImpl (ManagedChannelImpl $ LbHelperImpl. ) in io.grpc.internal.ManagedChannelImpl $ NameResolverListenerImpl.onUpdate (ManagedChannelImpl.java:752) at io.grpc.internal.DnsNameResolver $ 1.run (DnsNameResolver.java:174) at java.util.concurrent.ThreadPoolExecutor. util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:617) at java.lang.Thread.run (Thread.java:745)

+3


source to share


2 answers


I've observed this issue with Netty version 4.1.15.Final, but not with 4.1.13.Final. Check your transitive dependencies. Ie Spring Boot Links Netty.

What I added to the POM to make it work with the 0.22.0-beta Spanner API:

<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 that's not an option, plase will start your JVM with the appropriate bootclasspath entry, for example:

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

Be sure to replace /tmp/alpn-boot-8.1.11.v20170118.jar

with the banner location alpn to match your JVM version as mentioned on this page: https://www.eclipse.org/jetty/documentation/9.4.x/alpn-chapter.html

+1


source


There is a possible solution on github: " Exception when configuring SSL:" Jetty ALPN / NPN is not configured correctly. "

Recommended steps mentioned in the above document:

1) Edit catalina.sh / usr / local / Cellar / tomcat / 8.5.3 / libexec / bin / catalina.sh



2) On line 103 add the following CATALINA_OPTS = "- javaagent: /Library/Tomcat/lib/jetty-alpn-agent-2.0.6.jar"

3) Restart tomcat ../bin/shutdown.sh../bin/startup.sh

-1


source







All Articles